        <?=$this->tinyMce?>
<center><h3><?=$title?></h3></center>
      <? if ($this-> session-> flashdata('message')): ?>
    <div class='warning'>
      <?=$this-> session-> flashdata('message');?>
    </div>
    <? endif; ?>
<? if ($company) { ?>
<div>
          <h2>Φωτογραφία</h2>
           <? if ($edit_photo==false) { ?>
<p><a  title=""  href="<?=base_url().'images/cmps/'.$company['cmp_image']?>" rel="shadowbox[];options={counterType:'skip',continuous:true,animSequence:'sync'}"> <img class="center" src="<?=base_url().'images/cmps/thumb/'.$company['cmp_image']?>" style="max-width:120px; max-height:200px;" /> </a></p>
<h5><?=anchor("admin/categories/upload_company_photo/".$company['cmp_id'], 'Προσθήκη/Αλλαγή Φωτογραφίας')?></h5><br />
<h5><?=anchor("admin/categories/upload_company_photos/".$company['cmp_id'], 'Προβολή/Προσθήκη/Επεξεργασία Περισσότερων Φωτογραφιών για το ξενοδοχείο')?></h5><br />
<? } else { ?>
    <? $attributes = array('class' => 'nform'); ?>
    <?=form_open_multipart('admin/categories/upload_photo/'.$company['cmp_id'],$attributes); ?>
            <?=form_label('Επιλέξτε Φωτογραφία', 'uphoto')?>
            <? $data = array('name'=>'photo','id'=>'uphoto'); ?>
            <?php echo form_upload($data); ?> </div>
            <p>Για να ανεβάσετε την φωτογραφία σας, κάντε κλικ στο "Browse", εντοπίστε τη φωτογραφία στον υπολογιστή σας, και κάντε κλικ στο κουμπί "Upload". Η φωτογραφία σας πρέπει να είναι μικρότερη από 2 MB σε μέγεθος και πρέπει να είναι σε μια από τις ακόλουθες μορφές: JPG, JPEG, GIF, PNG</p>
  <div class="type-button">
    <?=form_submit('submit','upload');?>
  </div>
  <?=form_close(); ?>
<? } ?>
</div>
<div>
          <h2>Γενικές Πληροφορίες</h2>
              <table cellspacing="0" cellpadding="0" border="1" class="full">
      <tbody>
        <tr>
          <th scope="col">URL</th>
          <th scope="col">E-mail</th>
          <th scope="col">Ημερομηνία Προσθήκης</th>
          <th scope="col">Keywords</th>
          <th scope="col">Published</th>
          <th scope="col">Ενέργειες</th>
     </tr>
                     <? if (($edit==true) && ($company['cmp_id']==$edit_id)) { ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_company/'.$company['cmp_id'], $attributes); ?>
        <tr>
          <td>
        <?  echo "<p><label for='url'></label>";
		$data = array('name'=>'url','id'=>'url','size'=>15, 'value' => $company['cmp_url']);
echo form_input($data) ."</p>"; ?>
		</td>
          <td>
        <?  echo "<p><label for='email'></label>";
		$data = array('name'=>'email','id'=>'email','size'=>15, 'value' => $company['cmp_email']);
echo form_input($data) ."</p>"; ?>
		</td>
        <td><?=date("d.m.Y",mysql_to_unix($company['date_added']))?></td>
        <td>
        <?  echo "<p><label for='keywords'></label>";
		$data = array('name'=>'keywords','id'=>'keywords','size'=>15, 'value' => $company['keywords']);
		echo form_input($data) ."</p>"; ?>
		</td>
		<td>
        <? echo "<p><label for='published'></label>";
			$options = array('Yes' => 'Yes', 'No' => 'No');
			echo form_dropdown('published',$options, $company['published']) ."</p>"; ?>
		</td>
        <td><? echo form_submit('submit','update page')?><br /><?=anchor("admin/categories/view_company/".$company['cmp_id'], 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? } else { ?>
        <tr>
<td><?=$company['cmp_url']?></td>
<td><?=$company['cmp_email']?></td>
<td><?=date("d.m.Y",mysql_to_unix($company['date_added']))?></td>
<td><?=$company['keywords']?></td>
<td><?=$company['published']?></td>
<td><?=anchor("admin/categories/edit_company/".$company['cmp_id'], 'Επεξεργασία ξενοδοχείου')?></td>
                 </tr>
                 <? } ?>
      </tbody>
    </table>

          </div>
<div>
                    <h2>Λεπτομέρειες Εταιρίας</h2>
        <? $company_details = $this->MAdmins->getCompanyDetails($company['cmp_id']); ?>
		<? if ($edit_det==true) { ?>
      <? foreach($company_details as $company_details=>$company_det){ ?>
      <? if ($company_det['cmp_details_id']==$edit_id) { ?>
        <? $categories = $this->MAdmins->getCompanyCategories($company['cmp_id']); ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_company_details/'.$company_det['cmp_details_id']."/".$company_det['cmp_id'], $attributes); ?>

      <table cellspacing="0" cellpadding="0" border="1" class="fixed">
      	<thead>
           <tr><th colspan="100%" scope="col">Επεξεργασία εγγραφής Γλώσσα: <? if ($company_det['lang_id']=='1') { ?>
				<? echo "Greek"; ?>
                <? } else { ?>
 				<? echo "English"; ?>
				<? } ?></th></tr>
          </thead>
          <tbody>
            <tr>
              <th class="sub" scope="row">Επωνυμία</th>
              <td> <?  echo "<p><label for='name'></label>";
		$data = array('name'=>'name','id'=>'name','size'=>15, 'value' => $company_det['cmp_name']);
echo form_input($data) ."</p>"; ?></td>
            </tr>
             <tr>
              <th class="sub" scope="row">Περιγραφή</th>
              <td> <?  echo "<p><label for='longdesc'></label>";
$data = array('name'=>'longdesc','id'=>'longdesc','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_description']);
echo form_textarea($data) ."</p>"; ?></td>
            </tr>
            <tr>
              <th class="sub" scope="row">Όδος</th>
              <td><?  echo "<p><label for='address'></label>";
$data = array('name'=>'address','id'=>'address','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_address']);
echo form_input($data) ."</p>"; ?></td>
            </tr>
            <tr>
              <th class="sub" scope="row">Αριθμός</th>
              <td> <?  echo "<p><label for='number'></label>";
$data = array('name'=>'number','id'=>'number','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_num']);
echo form_input($data) ."</p>"; ?></td>
            </tr>
            <tr>
              <th class="sub" scope="row">Ταχ. Κώδικας</th>
              <td><?  echo "<p><label for='postal'></label>";
$data = array('name'=>'postal','id'=>'postal','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_postal']);
echo form_input($data) ."</p>"; ?> </td>
            </tr>
            <tr>
              <th class="sub" scope="row">Η Εταιρία</th>
              <td><?  echo "<p><label for='about'></label>";
$data = array('name'=>'about','id'=>'about','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_about']);
echo form_textarea($data) ."</p>"; ?></td>
            </tr>
            <tr>
              <th class="sub" scope="row">Επικοινωνία</th>
              <td><?  echo "<p><label for='contact'></label>";
$data = array('name'=>'contact','id'=>'contact','rows'=>'15', 'cols'=>'15', 'value' => $company_det['cmp_contact']);
echo form_textarea($data) ."</p>"; ?></td>
            </tr>
            <tr>
              <th class="sub" scope="row">Ενέργειες</th>
              <td><? echo form_submit('submit','update page')?><br /><?=anchor("admin/categories/view_company/".$company['cmp_id'], 'Ακύρωση')?></td>
            </tr>
        </tbody>
        </table>
                <? echo form_hidden('language',$company_det['lang_id']); ?>

<? echo form_close(); ?>
     <? } 
	  } ?>
     <? } ?>
  <table cellspacing="0" cellpadding="0" border="1" class="full">
      <tbody>
        <tr>
          <th scope="col">Επωνυμία</th>
         <th scope="col">Περιγραφή</th>
          <th scope="col">Οδός</th>
          <th scope="col">Αριθμός</th>
          <th scope="col">Ταχ. Κώδικας</th>
          <th scope="col">Η Εταιρία</th>
          <th scope="col">Επικοινωνία</th>
          <th scope="col">Γλώσσα</th>
          <th scope="col">Ενέργειες</th>
     </tr>
        <? $company_details = $this->MAdmins->getCompanyDetails($company['cmp_id']); ?>
        <? foreach($company_details as $company_details=>$company_det){ ?>
        <? $categories = $this->MAdmins->getCompanyCategories($company['cmp_id']); ?>
                <? if ((($edit_det==true) && ($company_det['cmp_details_id']!=$edit_id)) || ($edit_det==false)) { ?>
      <tr>
          <td><?=$company_det['cmp_name']?></td>
          <td><?=$company_det['cmp_description']?></td>
          <td><?=$company_det['cmp_address']?></td>
          <td><?=$company_det['cmp_num']?></td>
          <td><?=$company_det['cmp_postal']?></td>
          <td><?=$company_det['cmp_about']?></td>
          <td><?=$company_det['cmp_contact']?></td>
          <? if ($company_det['lang_id']==1) { ?>
          <td>Greek</td>
          <? } else { ?>
          <td>English</td>
         <? } ?>
          <td><?=anchor("admin/categories/edit_company_details/".$company_det['cmp_id']."/".$company_det['cmp_details_id'], 'Επεξεργασία λεπτομερειών εταιρίας')?></td>
       </tr>
		<? }
		} ?>
      </tbody>
    </table>

       </div>
<div>
                 <h2>Κατηγορία/ες Εταιρίας</h2>
              <table cellspacing="0" cellpadding="0" border="1" class="full">
      <tbody>
        <tr>
          <th scope="col">Διαθέσιμες Κατηγορίες</th>
          <th scope="col">Ενέργειες</th>
     </tr>
                 <? $allcategories = $this->MAdmins->getCategories2(); ?>

                     <? if (($edit_cat==true) && ($company['cmp_id']==$edit_id)) { ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_company_cat/'.$company['cmp_id'], $attributes); ?>
        <tr>
<td><? foreach ($allcategories as $allcategories => $category){ ?>
      <? $check = $this->MAdmins->checkCompanyCat($company['cmp_id'], $category['cat_id']); ?>
      <div class="type-check">
        <?=form_checkbox($category['cat_id'], $category['cat_id'], $check); ?>
        <? $category_name = $this->MAdmins->getCategoryName($category['cat_id'], 1); ?>
        <?=form_label($category_name['cat_name'])?>
      </div>
      <? }?></td>
      <td><? echo form_submit('submit','update page')?><br /><?=anchor("admin/categories/view_company/".$company['cmp_id'], 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? } else { ?>
        <tr>
          <td><? if ($categories) { foreach($categories as $categories=>$category){ ?>
           <? $category_name = $this->MAdmins->getCategoryName($category['cat_id'], 1); ?>
		  <?=$category_name['cat_name']?><br />
          <? }  } else { ?>No Categories Added <? } ?></td>
		<td><?=anchor("admin/categories/edit_company_cat/".$company['cmp_id'], 'Επεξεργασία κατηγοριών')?></td>
                 </tr>
                 <? } ?>
      </tbody>
    </table>

          </div>
       <div>
                 <h2>Υπο-Κατηγορία/ες Εταιρίας</h2>
           		 <? $categories = $this->MAdmins->getCompanyCategories($company['cmp_id']); ?>

                 <? if ($categories) { ?>
              <table cellspacing="0" cellpadding="0" border="1" class="full">
      <tbody>
        <tr>
          <th scope="col">Διαθέσιμες Υπο-Κατηγορίες</th>
          <th scope="col">Ενέργειες</th>
     </tr>
                 <? $subcategories = $this->MAdmins->getCompanySubCategories($company['cmp_id']); ?>


                     <? if (($edit_subcat==true) && ($company['cmp_id']==$edit_id)) { ?>
            <? $attributes = array('class' => 'nform'); ?>
		    <?=form_open('admin/categories/update_company_subcat/'.$company['cmp_id'], $attributes); ?>
        <tr>
<td><? foreach ($categories as $categories => $category){ ?>
                 <? $allsubcategories = $this->MAdmins->getSubCategoriesforCompany($category['cat_id']); ?>
                 <? foreach ($allsubcategories as $allsubcategories => $allsubcategory){ ?>
      <? $check = $this->MAdmins->checkCompanySubCat($company['cmp_id'], $allsubcategory['sub_id']); ?>
      <div class="type-check">
        <?=form_checkbox($allsubcategory['sub_id'], $allsubcategory['sub_id'], $check); ?>
        <? $subcategory_name = $this->MAdmins->getSubCategoryName($allsubcategory['sub_id'], 1); ?>
        <?=form_label($subcategory_name['name'])?>
      </div>
      <? } 
	  }?></td>
      <td><? echo form_submit('submit','update page')?><br /><?=anchor("admin/categories/view_company/".$company['cmp_id'], 'Ακύρωση')?></td>
       </tr>
       <? echo form_close(); ?>
       <? } else { ?>
        <tr>
          <td><? if ($subcategories) { foreach($subcategories as $subcategories=>$subcategory){ ?>
           <? $subcategory_name = $this->MAdmins->getSubCategoryName($subcategory['subcat_id'], 1); ?>
		  <?=$subcategory_name['name']?><br />
          <? }  } else { ?>No Sub-Categories Added <? } ?></td>
		<td><?=anchor("admin/categories/edit_company_subcat/".$company['cmp_id'], 'Επεξεργασία υπό-κατηγοριών')?></td>
        </tr>
                 <? } 
				 } else { ?>
                <p>Πρέπει να εισάγετε πρὠτα μια κατηγορία για να εισάγετε υπο-κατηγορία</p>
                 <? } ?>
      </tbody>
    </table>
</div>
<?    } ?>
