<?php 	if(! function_exists('check_session')){ die(); } ?>

	<center>
	<?php 
	$what	= $GLOBALS['what'];
	$rows	= $GLOBALS['rows'];
	switch($what){
	case 'add':
		$link	= 'pages.php?step=insert';
		$w1		= 'إضافة';
	break;
	case 'edit':
		$link	= 'pages.php?step=update&id='.$rows['id'].'&to='.$_GET['to'];
		$w1		= 'تعديل';
	break;
	}
	?>
    <form method="post" action="<?= $link; ?>">

	  <table style="width: 90%">
		  <tr>
			  <td class="head"><?= $w1; ?> صفحة</td>
		  </tr>
	  </table>
	  <table cellspacing="1" class="style4" style="width: 90%">
		  <tr>
			  <td class="right_table" >&nbsp;عنوان الصفحة :-&nbsp;</td>
			  <td class="left_table">
				  <input name="title" type="text" value="<?= $rows['title']; ?>" />
			</td>
		  </tr>
		  <tr>
			  <td class="right_table" >&nbsp;وصف قصير :-&nbsp;</td>
			  <td class="left_table">
				  <input name="desc" type="text" value="<?= $rows['desc']; ?>" />
			</td>
		  </tr>
		  <tr>
			  <td class="right_table" >&nbsp;المحتوى:-&nbsp;</td>
			  <td class="left_table">
				  <textarea name="content"><?= $rows['content']; ?></textarea>
				  <br />
				  <br /><center>
				  <div class="notice" style="width:250px">محتوى الصفحة , الحقل يقبل HTML</div>
				  </center>
			</td>
		  </tr>
		  <tr>
			  <td class="right_table" >&nbsp;اللغات التي ستظهر فيها الصفحة :-&nbsp;</td>
			  <td class="left_table">
				  <select name="languages_ids[]" multiple="multiple">
				  <option value="all" <?php if(in_array('all',$rows['languages_ids'])){ echo 'SELECTED'; } ?>>الكل</option>
				  <?php while($gro = mysql_fetch_array($GLOBALS['languages_query'])){ ?>
				  <option value="<?= $gro['id']; ?>" 
				  <? if(in_array($gro['id'],$rows['languages_ids'])){ echo 'SELECTED'; }?>><?= $gro['language']; ?></option>
				  <?php } ?>
			</td>
		  </tr>
		  <tr>
			  <td class="right_table" >&nbsp;المجموعة التي تستطيع رؤية الصفحة:-&nbsp;</td>
			  <td class="left_table">
				  <select name="group_id">
				  <option value="all" <?php if($rows['group_id'] == 'all'){ echo 'SELECTED'; } ?>>الكل</option>
				  <?php while($lng = mysql_fetch_array($GLOBALS['groups_query'])){ ?>
				  <option value="<?= $lng['id']; ?>" 
				  <? if($rows['group_id'] == $lng['id']){ echo 'SELECTED'; }?>><?= $lng['name']; ?></option>
				  <?php } ?>
			</td>
		  </tr>

		  <tr>
			  <td class="right_table" >&nbsp;الكلمات المفتاحية :-&nbsp;</td>
			  <td class="left_table">
				  <input type="text" name="meta_open" value="<?= $rows['meta_open'] ?>" />
			</td>
		  </tr>

		  <tr>
			  <td class="right_table" >&nbsp;كلمات الوصف :-&nbsp;</td>
			  <td class="left_table">
				  <input type="text" name="meta_desc" value="<?= $rows['meta_desc'] ?>" />
			</td>
		  </tr>


		  </table>

	  
  <br/>
  <br/>
  <div align="center">
		<input type="submit" value="<?= $w1; ?> الصفحة" class="button" />
		</div>
			</form>

</center>