<?
ob_start();
require_once("functions.php");
    if(!isset($_COOKIE[$admin])){
        header('Location: index.php');
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

<body onload="clickMenu('menu')">
<!-- outer -->
<div id="outer">
	<!-- header ----------------------------------------------------->
	<div id="header"> <? include("header.php")?> </div>
	<!-- header -->

    <!-- content ---------------------------------------------------->
	<div id="content">
        <!-- con_right --------------------------------------->
	   <div id="con_right">
            <div class="title_page">&nbsp;</div>
            <!--<a href="add_father.php"><div class="add_father"><img src="images/add_48.png" /> إضافة قسم</div></a>-->

            <div class="path_page">
               <div style="text-align:right;">
					<a href="info.php">الرئيسية</a>
					<img src="images/001_27.gif" width="10" height="10" />
                    <a href="edit_customer.php">الموردين</a>
                    <img src="images/001_27.gif" width="10" height="10" />
										<?
                                            $iddd=$_GET['id'];
                                            $sel = "select name from src_jornal where langu='en' and id=$iddd";
                                            $query = mysql_query($sel);
                                            while($result=mysql_fetch_array($query)){
                                                extract($result);
                                            }
                                        ?>
                    <?=$name?>
                </div>
            </div>
            <div class="conteaner">
                <div class="details_page">

                </div>
                <div class="title_editor">
                	<span class="title" style="float:left; margin-left:20px;">

                        <a href='add_customer.php' style="text-decoration:none; color: #00FFFF;">
                         	إضافة جديد
                         </a>



                    </span>
                    <span class="title">
                        <?php
                                $iddd=$_GET['id'];

                                $code_f = $_POST['code_f'];
							  //	$name_f = $_POST['name_f'];
                                $name_f = str_replace("'","&#96",$_POST['name_f']);
                                //$intro_f = $_POST['intro_f'];
								//$intro_f = $_POST['intro_f'];
								$pic_f = $_POST['pic_f'];
								$extention_pic_f = $_POST['extention_pic_f'];
//								$desc_pic_f = $_POST['desc_pic_f'];
                                $desc_pic_f=str_replace("'","&#96",$_POST['desc_pic_f']);
								//$category_f = $_POST['category_f'];
								//$location_f = $_POST['location_f'];

								$active_f = $_POST['active_f'];
								//$archeef_f = $_POST['archeef_f'];

								//$source_f = $_POST['source_f'];
								//$year_show_f = $_POST['year_show_f'];
								///$month_show_f = $_POST['month_show_f'];
								//$day_show_f = $_POST['day_show_f'];
								//$date_show_f = "$year_show_f-$month_show_f-$day_show_f";

								date_default_timezone_set("Africa/Cairo");
								$time=time();
								$date_f=date("Y-m-d");
								$date_time_f=date("y-m-d h:i:s",$time-3600);
								$time_f=date("h:i:s",$time-3600);

                                $submit = $_POST['submit'];
								if($submit){
                                        if($name_f != ""){
                                                    //to send data from editor to db
                                                    $result = "update src_jornal set

																					type='customer',

																					name='$name_f',

                                                                                    pic='$pic_f',
                                                                                    extention_pic='$extention_pic_f',
                                                                                    desc_pic='$desc_pic_f',

																					create_by='$month_show_f',
																					date_creat='$date_time_f',

																					last_edit_by='$username_now',
																					date_last_edit='$date_time_f',

																				   active='$active_f',
                                                                                   langu='en'

                                                                                where id='$iddd'";
                                                    $query = mysql_query($result);

                                                    header('Location: edit_customer.php');
                                        }else{echo "<font color='red'>sory!! من فضلك ادخل البيانات كاملة</font>";}
                                }
                        ?>
                    </span>
                </div>

                <div class="editor">


                		<?
                        $iddd=$_GET['id'];
                        ?>
                            <form method="post" action="edit_customer_in.php?id=<?=$iddd?>">

                                <table class="table_color">
                                 <!--
                                 <tr>
                                    <td class="ti_ro">كود المقال :</td>
                                    <td>
                                    	<?
										//fetch data from db to fckeditor
                                                   $seldb = "select code from src_jornal where id = $iddd";
                                                   $querydb = mysql_query($seldb);
                                                   while($resultdb = mysql_fetch_array($querydb)){
                                                         if($resultdb){
                                                             extract($resultdb);
                                                          }
                                                   }
										?>
                                    	<input class="typ_ro" type="text" name="code_f" value="<?=$code?>" disabled="disabled" />
                                        <input class="typ_ro" type="hidden" name="code_f" value="<?=$code?>" />

                                    </td>
                                </tr>
                                -->

                                <tr>
                                    <td class="ti_ro">الاسم : *</td>
                                    <td>
                                    	<?
										//fetch data from db to fckeditor
                                                   $seldb = "select name from src_jornal where id = $iddd";
                                                   $querydb = mysql_query($seldb);
                                                   while($resultdb = mysql_fetch_array($querydb)){
                                                         if($resultdb){
                                                             extract($resultdb);
                                                          }
                                                   }
										?>
                                    	<input class="typ_ro" style="text-align: right;" type="text" size="87" name="name_f" value="<?=$name?>" />
                                    </td>
                                </tr>
                                <!--
                                <tr>
                                    <td class="ti_ro">المقدمة :</td>
                                    <td>
                                    	<?
										//fetch data from db to fckeditor
                                                   $seldb = "select intro from src_jornal where id = $iddd";
                                                   $querydb = mysql_query($seldb);
                                                   while($resultdb = mysql_fetch_array($querydb)){
                                                         if($resultdb){
                                                             extract($resultdb);
                                                          }
                                                   }
										?>
                                    	<textarea class="desmsgt" style="text-align: right;" cols="65" rows="10" name="intro_f"><?=$intro?></textarea>
                                    </td>
                                </tr>
                                -->

                            	<tr>
                                            <?
                                                $seldb = "select pic,extention_pic from src_jornal where id = $iddd";
                                                $querydb = mysql_query($seldb);
                                                while($resultdb = mysql_fetch_array($querydb)){
                                                    if($resultdb){
                                                        extract($resultdb);
                                                    }
                                                }
                                            ?>
                                    <td class="ti_ro" valign="top">الصورة :<br /><img src="../upload/customer/<?=$pic.$extention_pic?>" width="50" height="50" /></td>
                                    <td>

                                        <input type="text" name="pic_f" value="<?=$pic?>" />
                                        <select name="extention_pic_f" dir="ltr">
                                            <option value="<?=$extention_pic?>" selected="selected"><?=$extention_pic?></option>
                                            <option value=".jpg">.jpg</option>
                                            <option value=".png">.png</option>
                                            <option value=".gif">.gif</option>
                                            <option value=".jpeg">.jpeg</option>
                                            <option value=".bmp">.bmp</option>
                                            <option value=""></option>
                                        </select>


                                        <a style="text-decoration: none; color: #000; text-decoration: underline;" title="رفع الملفات" href="load_files_customer/example/load.php" target="_blank">
                                            <img src="images/loadpics.png" width="3%" title="رفع الملفات" style="margin: 5px; border: 2px solid #gray;" />
                                           رفع صورة
                                        </a>


                                    </td>
                                </tr>
                                <tr>
                                    <td class="ti_ro" valign="top">وصف الصورة :</td>
                                    <td>
                                    		<?
                                                $seldb = "select desc_pic from src_jornal where id = $iddd";
                                                $querydb = mysql_query($seldb);
                                                while($resultdb = mysql_fetch_array($querydb)){
                                                    if($resultdb){
                                                        extract($resultdb);
                                                    }
                                                }
                                            ?>
                                        <textarea class="desmsgt" dir="rtl" cols="65" rows="1" name="desc_pic_f"><?=$desc_pic?></textarea>
                                    </td>
                                </tr>


                                <tr>
                                    <td class="ti_ro">الإخفاء/الظهور : </td>
                                    <td>
                                        <select name="active_f">
                                            <?
                                                $sel = "select active from src_jornal where id = $iddd";
                                                    $query = mysql_query($sel);
                                                    while($result = mysql_fetch_array($query)){
                                                        extract($result);
                                                        if($active == "1"){
                                                            echo "<option value='1' selected='selected'>ظهور</option>";
                                                        }elseif($active == "0"){
                                                            echo "<option value='0' selected='selected'>إخفاء</option>";
                                                        }

                                                    }

                                            ?>
                                            <option value="1">ظهور</option>
                                            <option value="0">إخفاء</option>
                                        </select>
                                    </td>
                                </tr>

                         </table>
                		<div class="submit"><input type="submit" name="submit" value="تعديل" /></div>
                    </form>

                </div>

            </div>
       </div>
	   <!-- /con_right -->

       <!-- con_left ---------------------------------------->
	   <div id="con_left">
            <!-- menu ---------------------------------->
            <div id="menuall"> <? include("menu.php")?> </div>
            <!-- /menu -->

            <!-- calender ------------------------------>
            <div id="calender"><embed src="images/Calender.swf" width="235" height="320" /></embed></div>
            <!-- /calender -->
       </div>
	   <!-- /con_left ---------------------------------------->
    </div>
	<!-- /content -->

    <!-- footer ----------------------------------------------------->
	<div id="footer"> <? include("footer.php")?> </div>
	<!-- /footer -->
</div>
<!-- /outer -->
</body>
</html>
<?ob_flush();?>