        <?=$this->tinyMce?>
<center><h3><?=$title?></h3></center>
      <? if ($this-> session-> flashdata('message')): ?>
    <div class='warning'>
      <?=$this-> session-> flashdata('message');?>
    </div>
    <? endif; ?>
<div>
       <h2>Varieties</h2>
          <? if ($add_var==false) { ?>
          <h4><?=anchor("admin/categories/add_variety", 'Προσθήκη νέας ποικιλίας')?></h4>
          <? } ?>
<? if ($add_var==true) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Varieties</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <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_variety', $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='text'></label>";
		$data = array('name'=>'text'.$language['lang_id'],'id'=>'text'.$language['lang_id'],'size'=>15);
echo form_textarea($data) ."</p>"; ?>
<br />
<? } ?>
		</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 variety')?><br /><?=anchor("admin/categories/varieties", 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? if (!$varieties) { ?>
      </tbody>
    </table>
    <? } ?>
<?    } ?>
<? if ($varieties) { ?>
<? if ($add_var==false) { ?>
    <table cellspacing="0" cellpadding="0" border="1" class="full">
      <thead>
        <tr>
          <th colspan="100%" scope="col">Varieties</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="col">Όνομα</th>
          <th scope="col">Περιγραφή</th>
          <th scope="col">Γλώσσα</th>
          <th scope="col">Ενέργειες</th>
        </tr>
        <? } ?>
        <? foreach($varieties as $varieties=>$variety){ ?>
        <? if (($edit_var==true) && ($variety['id']==$edit_id)) { ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_variety/'.$variety['id'].'/'.$variety['var_id'],$attributes); ?>
        <tr>
          <td> <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
            		   <? $variety_name = $this->MAdmins->getVarietiesbyLang($variety['var_id'], $language['lang_id']); ?>
                    <?  echo "<label for='name'></label>";
		$data = array('name'=>'name'.$language['lang_id'],'id'=>'name'.$language['lang_id'],'size'=>15,  'value' => $variety_name['name']);
echo form_input($data) .""; ?>
<br />
<? } ?>
		</td>
          <td> <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
            <? $variety_name = $this->MAdmins->getVarietiesbyLang($variety['var_id'], $language['lang_id']); ?>
                    <?  echo "<label for='text'></label>";
		$data = array('name'=>'text'.$language['lang_id'],'id'=>'text'.$language['lang_id'],'size'=>15,  'value' => $variety_name['text']);
echo form_textarea($data) .""; ?>
<br />
<? } ?>
		</td>
        <td>
        <? $languages = $this->MAdmins->getLanguages();
		foreach($languages as $languages=>$language){ ?>
        <?=$language['lang_name']?>
        <br />
        <? } ?>
		</td>
        <td><? echo form_submit('submit','update variety')?><br /><?=anchor("admin/categories/varieties", 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? } else { ?>
        <tr>
          <td>
		   <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
		   <? $variety_name = $this->MAdmins->getVarietiesbyLang($variety['var_id'], $language['lang_id']); ?>
		   <?=$variety_name['name']?><br /><? } ?></td>
          <td>
		   <? 	$languages = $this->MAdmins->getLanguages();
			foreach($languages as $languages=>$language){ ?>
		   <? $variety_name = $this->MAdmins->getVarietiesbyLang($variety['var_id'], $language['lang_id']); ?>
		   <?=$variety_name['text']?><br /><? } ?></td>
        <td>
        <? $languages = $this->MAdmins->getLanguages();
		foreach($languages as $languages=>$language){ ?>
        <?=$language['lang_name']?>
        <br />
		<? }  ?>
		</td>
          <td><?=anchor("admin/categories/edit_variety/".$variety['id'], 'Επεξεργασία εγγραφής')?><Br /><?=anchor("admin/categories/delete_variety/".$variety['var_id'],  'Διαγραφή εγγραφής', array( 'onclick'=>'return confirm(\''.'Είστε σίγουροι πως θέλετε να προχωρήσετε στη διαγραφή?'.'\');', 'title' => '','class' => ''))?></td>
      </tr>
       <? }
	   } ?>
      </tbody>
    </table>
<?    } ?>
          </div>