<?php
/**
  @licence GPL 2005-2011  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  16/04/11, 15:47
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
?>
<?php if($action == 'deleteconfirm' ) { ?>
  <h4><?php echo TEXT_INFO_HEADING_DELETE_NAV; ?></h4>
  <hr />
    <?php echo tep_draw_form('orders', FILENAME_NAVIGATION_LINKS, tep_get_all_get_params(array('oID', 'action')) . 'nID=' . $_GET['nID'] . '&amp;action=delete'); ?>
      <p><?php echo TEXT_INFO_DELETE_INTRO; ?></p>
      <div class="button_nav">
	<?php echo tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a  class="button"  href="' . tep_href_link(FILENAME_NAVIGATION_LINKS, tep_get_all_get_params(array('nID', 'action','forceajax')) ) . '">' . IMAGE_CANCEL . '</a>'; ?>
      </div>
    </form>

<?php }elseif($action == 'new' || ($action == 'edit' && isset($_GET['nID']) )) {
  echo tep_draw_form('adminForm', FILENAME_NAVIGATION_LINKS , $action_post_form,'post') ;?>
    <h3><?php echo HEADING_TITLE_NEW_MENU ; ?></h3>
    <div class="block_form">
      <div class="tabs_lang">
          <ul>
            <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?>
              <li><a href="#nav_link_<?php echo $i ?>"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?></a></li>
            <?php  } ?>
          </ul>
          <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++){ ?>
            <p id="nav_link_<?php echo $i ?>">
              <label for="name<?php echo $i ;?>"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '&nbsp;'.FIELDSET_NAME ;?></label>
              <?php echo tep_draw_input_field('nav_link_name['.$languages[$i]['id'].']', 'name'.$i, (isset($_GET['nID'])? oscss_get_navlink_name($_GET['nID'],$languages[$i]['id']) : '') ) ;?>
            </p>
          <?php } ?>
      </div>

      <fieldset class="block_field">
        <legend><?php echo FIELDSET_DATAS ; ?></legend>
        <p class="block_input">
          <label for="nav_link_status" title="<?php echo ENTRY_STATUS_DESC ; ?>"><?php echo ENTRY_STATUS_ON . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
            <?php echo tep_draw_radio_field('nav_link_status', '1','1', (($nav_links['nav_link_status']==1)?true:false)) ;?>
          <label><?php echo ENTRY_STATUS_OFF ; ?></label>
            <?php echo tep_draw_radio_field('nav_link_status', '0','0', (($nav_links['nav_link_status']==2)?true:false)) ;?>
        </p>
        <p class="block_input">
          <?php echo  tep_draw_pull_down_menu('parent_id', array_merge(array(array('id'=>'', 'text'=> TXT_CAT_ALL)),parent_item_nav(/*array($nav_links['nav_link_id'])*/)), $nav_links['parent_id']); ?>
        </p>
        <p class="block_input">
          <label for="internal" title="<?php echo ENTRY_INTERNAL_LINK_DESC ; ?>"><?php echo ENTRY_INTERNAL_LINK . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
            <?php echo tep_draw_radio_field('type', 'internal','0', (($nav_links['nav_link_type']==0 || empty($nav_links['nav_link_type']) )?true:false) ) ;?><br />
          <label for="external" title="<?php echo ENTRY_EXTERNAL_LINK_DESC ; ?>"><?php echo ENTRY_EXTERNAL_LINK . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
            <?php echo tep_draw_radio_field('type', 'external','1', (($nav_links['nav_link_type']==1)?true:false)) ;?>
          <label for="function" title="<?php echo ENTRY_FUNCTION_LINK_DESC ; ?>"><?php echo ENTRY_FUNCTION_LINK . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
            <?php echo tep_draw_radio_field('type', 'function','2', (($nav_links['nav_link_type']==2)?true:false)) ;?>
        </p>
        <p class="block_input">
          <label for="link" title="<?php echo ENTRY_TARGET_DESC ; ?>"><?php echo ENTRY_TARGET . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
          <?php echo tep_draw_input_field('link', '',tep_not_null(@$nav_links['nav_file']) ? $nav_links['nav_file']  : '') ;?>
        </p>
        <p class="block_input">
          <label for="css_id" title="<?php echo ENTRY_CSS_DESC ; ?>"><?php echo ENTRY_CSS . tep_image(DIR_WS_ICONS . 'icon_help.gif'); ?></label>
          <?php echo tep_draw_input_field('css_id', '',tep_not_null(@$nav_links['nav_css_id']) ? $nav_links['nav_css_id']  : '') ;?>
        </p>
        <p class="block_input">
          <label for="sort" title="<?php echo ENTRY_SORT_ORDER_DESC ; ?>"><?php echo ENTRY_SORT_ORDER . tep_image(DIR_WS_ICONS . 'icon_help.gif') ; ?></label>
          <?php echo tep_draw_input_field('sort', '',tep_not_null(@$nav_links['nav_sort_order']) ? $nav_links['nav_sort_order']  : '') ;?>
        </p>
        <p class="block_input">
          <label for="condition" title="<?php echo ENTRY_CONDITION_DESC ; ?>"><?php echo ENTRY_CONDITION . tep_image(DIR_WS_ICONS . 'icon_help.gif') ; ?></label>
          <?php echo tep_draw_pull_down_menu('condition', $navlink_condition, @$nav_links['customers_status'], 'id="condition"') ;?>
        </p>
      </fieldset>
      <div class="button_nav">
        <?php echo tep_image_submit('button_save.gif', IMAGE_SAVE) .'<a class="button" href="' . tep_href_link(FILENAME_NAVIGATION_LINKS) . '">' . IMAGE_CANCEL . '</a>'; ?>
      </div>
    </div>
  </form>
<?php } else { ?>

  <h3><?php echo HEADING_TITLE ;?></h3>

  <?php echo tep_draw_form('adminForm', FILENAME_NAVIGATION_LINKS ,'action=sort' ,'post') ;?>

  <div class="button_nav">
    <?php echo tep_image_submit('button_save.gif', IMAGE_UPDATE). '<a class="button" href="' . tep_href_link(FILENAME_NAVIGATION_LINKS , 'action=new') . '">' . tep_image(DIR_WS_ICONS. 'icon_add_new.png', IMAGE_INSERT ) . IMAGE_INSERT . '</a>'; ?>
  </div>

    <div class="box_uniq">
      <table class="dataTable">
      <thead>
        <tr>
          <th><?php echo TABLE_HEADING_NAME ; ?></th>
          <th><?php echo TABLE_HEADING_PARENT; ?></th>
          <th><?php echo TABLE_HEADING_TARGET ; ?></th>
          <th><?php echo TABLE_HEADING_CSS; ?></th>
          <th class="tcenter"><?php echo TABLE_HEADING_SORT_ORDER; ?></th>
          <th><?php echo TABLE_HEADING_CONDITION; ?></th>
          <th class="tcenter"><?php echo TABLE_HEADING_STATUS; ?></th>
          <th class="row_action"><?php echo TABLE_HEADING_ACTION; ?></th>
        </tr>
      </thead>
      <tbody>
      <?php foreach($arry_navlink as $nav_links){ ?>
        <tr class="view parent dataTableRow">
          <td><?php for($i=0;$i<$nav_links['niveau'];$i++) echo '-';  echo '&nbsp;'.oscss_get_navlink_name($nav_links['nav_link_id'],$languages_id) ;?></td>
          <td><?php echo oscss_get_navlink_name($nav_links['parent_id'],$languages_id);?></td>
          <td><?php echo $nav_links['nav_file'] ;?></td>
          <td><?php echo $nav_links['nav_css_id'] ;?></td>
          <td class="tcenter"><?php echo tep_draw_input_field('sort_order[]','sort_order_'.$nav_links['nav_link_id'],$nav_links['nav_sort_order'],'style="width:30px"') .  tep_draw_hidden_field('nav_link_id[]', 'nav_link_id_'.$nav_links['nav_link_id'], $nav_links['nav_link_id']) ;?></td>
          <td class="tleft"><?php echo $NAVLINK_CONDITION[$nav_links['customers_status']] ;?></td>
          <td class="tcenter"><?php echo $nav_links['status_image'] ;?></td>
          <td class="row_action">
	    <span class="view fils"><?php echo '<a class="buttonimg" href="'.tep_href_link(FILENAME_NAVIGATION_LINKS , 'action=edit&amp;nID='.$nav_links['nav_link_id']).'">'.tep_image(DIR_WS_ICONS . 'icon_edit.png', IMAGE_EDIT) .'</a>' .'<a class="buttonimg fancy" href="'.tep_href_link(FILENAME_NAVIGATION_LINKS, 'nID=' . $nav_links['nav_link_id'] . '&amp;action=deleteconfirm').'">'.tep_image(DIR_WS_ICONS . 'icon_delete.png', IMAGE_DELETE).'</a>'; ?>
	    </span>
          </td>
        </tr>
      <?php } ?>
      </tbody>
      </table>
    </div>
  </form>

<?php } ?>