        <?=$this->tinyMce?>
<center><h3><?=$title?></h3></center>
      <? if ($this-> session-> flashdata('message')): ?>
    <div class='warning'>
      <?=$this-> session-> flashdata('message');?>
    </div>
    <? endif; ?>
          <h2>Sub-Categories for: <?=$category['cat_name']?></h2>
          <? if ($add_subcat==false) { ?>
          <h4><?=anchor("admin/categories/add_subcategory/".$category['id'], 'Προσθήκη νέας υπο-κατηγορίας')?></h4>
          <? } ?>
<? if ($add_subcat==true) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Sub-Categories</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="col">Όνομα</th>
          <th scope="col">Σειρά</th>
          <th scope="col">Κεντρική Σελίδα</th>
          <th scope="col">Γλώσσα</th>
          <th scope="col">Ενέργειες</th>
        </tr>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/add_subcategory/'.$category['cat_id'], $attributes); ?>
        <tr>
          <td>
                      <? $languages = $this->MAdmins->getLanguages();
					  foreach($languages as $languages=>$language){ ?>
        <?  echo "<p><label for='name'></label>";
		$data = array('name'=>'name'.$language['lang_id'],'id'=>'name'.$language['lang_id'],'size'=>15);
echo form_input($data) ."</p>"; ?>
<br />
<? } ?>
		</td>
          <td>
                      <? $languages = $this->MAdmins->getLanguages();
					  foreach($languages as $languages=>$language){ ?>
        <?  echo "<p><label for='order'></label>";
		$data = array('name'=>'order'.$language['lang_id'],'id'=>'order'.$language['lang_id'],'size'=>15);
echo form_input($data) ."</p>"; ?>
<br />
<? } ?>
		</td>
 		<td>
        <? echo "<p><label for='home_page'></label>";
			$options = array('Yes' => 'Yes', 'No' => 'No');
			echo form_dropdown('home_page',$options, 'No') ."</p>"; ?>
		</td>
       <td>
        <? $languages = $this->MAdmins->getLanguages();
		foreach($languages as $languages=>$language){ ?>
        <? echo "<p>".$language['lang_name']."</p>"; ?>
        <br />
		<? }  ?>
		</td>
        <td><? echo form_submit('submit','add sub category')?><br /><?=anchor("admin/categories/view_category/".$category['cat_id'], 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? if (!$subcategories) { ?>
      </tbody>
    </table>
    <? } ?>
<?    } ?>
<? if ($subcategories) { ?>
<? if ($add_subcat==false) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Sub-Categories</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="col">Όνομα</th>
          <th scope="col">Σειρά</th>
          <th scope="col">Κεντρική Σελίδα</th>
          <th scope="col">Γλώσσα</th>
          <th scope="col">Ενέργειες</th>
        </tr>
        <? } ?>
        <? foreach($subcategories as $subcategories=>$subcategory){ ?>
        <? if (($edit_subcat==true) && ($subcategory['sub_id']==$edit_id)) { ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_subcategory/'.$category['id'].'/'.$subcategory['sub_id'],$attributes); ?>
        <tr>
          <td> <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
            		   <? $subcategory_name = $this->MAdmins->getSubCategoriesbyLang2($subcategory['sub_id'], $language['lang_id']); ?>
                    <?  echo "<label for='name'></label>";
		$data = array('name'=>'name'.$language['lang_id'],'id'=>'name'.$language['lang_id'],'size'=>15,  'value' => $subcategory_name['name']);
echo form_input($data) .""; ?>
<br />
<? } ?>
		</td>
          <td> <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
            		   <? $subcategory_name = $this->MAdmins->getSubCategoriesbyLang2($subcategory['sub_id'], $language['lang_id']); ?>
                    <?  echo "<label for='order'></label>";
		$data = array('name'=>'order'.$language['lang_id'],'id'=>'order'.$language['lang_id'],'size'=>15,  'value' => $subcategory_name['order']);
echo form_input($data) .""; ?>
<br />
<? } ?>
		</td>
         <td>        <? echo "<p><label for='home_page'></label>";
			$options = array('Yes' => 'Yes', 'No' => 'No');
			echo form_dropdown('home_page',$options, $subcategory['home_page']) ."</p>"; ?>
</td>
       <td>
        <? $languages = $this->MAdmins->getLanguages();
		foreach($languages as $languages=>$language){ ?>
        <?=$language['lang_name']?>
        <br />
        <? } ?>
		</td>
        <td><? echo form_submit('submit','update sub-category')?><br /><?=anchor("admin/categories/view_category/".$category['id'], 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? } else { ?>
        <tr>
          <td>
		   <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
		   <? $subcategory_name = $this->MAdmins->getSubCategoriesbyLang2($subcategory['sub_id'], $language['lang_id']); ?>
		   <?=$subcategory_name['name']?><br /><? } ?></td>
          <td>
		   <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
		   <? $subcategory_name = $this->MAdmins->getSubCategoriesbyLang2($subcategory['sub_id'], $language['lang_id']); ?>
		   <?=$subcategory_name['order']?><br /><? } ?></td>
           <td><?=$subcategory['home_page']?></td>
        <td>
        <? $languages = $this->MAdmins->getLanguages();
		foreach($languages as $languages=>$language){ ?>
        <?=$language['lang_name']?>
        <br />
		<? }  ?>
		</td>
          <td><?=anchor("admin/categories/edit_subcategory/".$category['id'].'/'.$subcategory['sub_id'], 'Επεξεργασία εγγραφής')?><Br /><?=anchor("admin/categories/view_sub_category/".$subcategory['sub_id'], 'Υπο-κατηγορία/ες')?><Br /><?=anchor("admin/categories/delete_subcategory/".$category['id'].'/'.$subcategory['sub_id'],  'Διαγραφή εγγραφής', array( 'onclick'=>'return confirm(\''.'Είστε σίγουροι πως θέλετε να προχωρήσετε στη διαγραφή?'.'\');', 'title' => '','class' => ''))?>
      </tr>
       <? }
	   } ?>
      </tbody>
    </table>
<?    } else {?>
<h5>Δεν υπάρχουν υπο-κατηγορίες</h5>
<? } ?> 
          <h4><?=anchor("admin/categories/settings", 'Επιστροφή στις ρυθμίσεις')?></h4>