<?php

/****************************************************************************
 * CODE FILE   : main_menu.php
 * Project     : BitTS - BART it TimeSheet
 * Author(s)   : Erwin Beukhof
 * Date        : 12 october 2012
 * Description : Main navigation menu
 *
 *               Framework: osCommerce, Open Source E-Commerce Solutions
 *               http://www.oscommerce.com
 */
?>
<!-- main_menu //-->
          <tr>
            <td>
<?php 
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_MAINMENU);
new infoBoxHeading($info_box_contents, true, true);
$info_box_contents = array();
$info_box_contents[] = array('text' => tep_draw_form('menu_100', tep_href_link(FILENAME_DEFAULT)) . tep_create_parameters(array('mPath' => '100'), array('period'), 'hidden_field') . tep_href_submit(BOX_MAINMENU_HOME, 'submitLinkInfoBoxContents', $_POST['mPath'] == '100' || $_POST['mPath'] == '' ? 'style="font-weight:bold;cursor:default" disabled' : '') . '</form><br>' . '<br>' . tep_draw_form('menu_200', tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('mPath' => '200'), array('period'), 'hidden_field') . tep_href_submit(BOX_MAINMENU_TIMEREGISTRATION, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['timeregistration'] ? $_POST['mPath'] == '200' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . (substr($_POST['mPath'], 0, 1) == '2' ? '' . tep_draw_form('menu_211', tep_href_link(FILENAME_TIMEREGISTRATION_PUNCH_CLOCK)) . tep_create_parameters(array('mPath' => '211'), array('period'), 'hidden_field') . '&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_TIMEREGISTRATION_PUNCH_CLOCK, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['timeregistration'] ? $_POST['mPath'] == '211' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_212', tep_href_link(FILENAME_TIMEREGISTRATION_CALENDAR)) . tep_create_parameters(array('mPath' => '212'), array('period'), 'hidden_field') . '&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_TIMEREGISTRATION_CALENDAR, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['timeregistration'] ? $_POST['mPath'] == '212' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' : '') . tep_draw_form('menu_300', tep_href_link(FILENAME_ANALYSIS)) . tep_create_parameters(array('mPath' => '300'), array('period'), 'hidden_field') . tep_href_submit(BOX_MAINMENU_ANALYSIS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['analysis'] ? $_POST['mPath'] == '300' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_400', tep_href_link(FILENAME_ADMINISTRATION)) . tep_create_parameters(array('mPath' => '400'), array('period'), 'hidden_field') . tep_href_submit(BOX_MAINMENU_ADMINISTRATION, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '400' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form>' . (substr($_POST['mPath'], 0, 1) == '4' ? '<br>' . tep_draw_form('menu_410', tep_href_link(FILENAME_ADMINISTRATION)) . tep_create_parameters(array('mPath' => '410'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_GENERAL, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '410' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . (substr($_POST['mPath'], 0, 2) == '41' ? '' . tep_draw_form('menu_411', tep_href_link(FILENAME_ADMINISTRATION_EMPLOYEES)) . tep_create_parameters(array('mPath' => '411'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_EMPLOYEES, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '411' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_412', tep_href_link(FILENAME_ADMINISTRATION_TIMESHEETS)) . tep_create_parameters(array('mPath' => '412'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_TIMESHEETS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '412' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_413', tep_href_link(FILENAME_ADMINISTRATION_BENEFITS)) . tep_create_parameters(array('mPath' => '413'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_BENEFITS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '413' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' : '') . tep_draw_form('menu_420', tep_href_link(FILENAME_ADMINISTRATION)) . tep_create_parameters(array('mPath' => '420'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_SYSTEM, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '420' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . (substr($_POST['mPath'], 0, 2) == '42' ? '' . tep_draw_form('menu_421', tep_href_link(FILENAME_ADMINISTRATION_CUSTOMERS)) . tep_create_parameters(array('mPath' => '421'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_CUSTOMERS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '421' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_422', tep_href_link(FILENAME_ADMINISTRATION_BUSINESS_UNITS)) . tep_create_parameters(array('mPath' => '422'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_BUSINESS_UNITS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '422' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_423', tep_href_link(FILENAME_ADMINISTRATION_CATEGORIES)) . tep_create_parameters(array('mPath' => '423'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_CATEGORIES, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '423' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_424', tep_href_link(FILENAME_ADMINISTRATION_UNITS)) . tep_create_parameters(array('mPath' => '424'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_UNITS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '424' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_425', tep_href_link(FILENAME_ADMINISTRATION_PROFILES)) . tep_create_parameters(array('mPath' => '425'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_PROFILES, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '425' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' : '') . tep_draw_form('menu_430', tep_href_link(FILENAME_ADMINISTRATION)) . tep_create_parameters(array('mPath' => '430'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_PROJECTS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '430' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form>' . (substr($_POST['mPath'], 0, 2) == '43' ? '<br>' . tep_draw_form('menu_431', tep_href_link(FILENAME_ADMINISTRATION_PROJECTS)) . tep_create_parameters(array('mPath' => '431'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_PROJECTS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '431' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_432', tep_href_link(FILENAME_ADMINISTRATION_ROLES)) . tep_create_parameters(array('mPath' => '432'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_ROLES, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '432' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_433', tep_href_link(FILENAME_ADMINISTRATION_EMPLOYEES_ROLES)) . tep_create_parameters(array('mPath' => '433'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_EMPLOYEES_ROLES, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '433' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form><br>' . tep_draw_form('menu_434', tep_href_link(FILENAME_ADMINISTRATION_TARIFFS)) . tep_create_parameters(array('mPath' => '434'), null, 'hidden_field') . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . tep_href_submit(BOX_MAINMENU_ADMINISTRATION_TARIFFS, 'submitLinkInfoBoxContents', $_SESSION['employee']->profile->right['administration'] ? $_POST['mPath'] == '434' ? 'style="font-weight:bold;cursor:default" disabled' : '' : 'style="cursor:default" disabled') . '</form>' : '') : ''));
new infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- main_menu_eof //-->
          <tr>
            <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '20');
?>
</td>
          </tr>
          <tr>
            <td>
              <table border="0" width="100%" cellspacing="0" cellpadding="2" class="entryListing">
                <tr>
                  <td class="entryListing-heading"><?php 
echo tep_draw_form('sort_activities_date', tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('sort_order' => $_POST['sort_order'] == 'activities_date asc' ? 'activities_date desc' : 'activities_date asc'), array('mPath', 'period'), 'hidden_field') . tep_href_submit(TEXT_ACTIVITY_DAY, 'submitLinkInfoBoxHeading') . ($_POST['sort_order'] == 'activities_date asc' ? tep_image(DIR_WS_IMAGES . 'triangle_down.png') : ($_POST['sort_order'] == 'activities_date desc' ? tep_image(DIR_WS_IMAGES . 'triangle_up.png') : tep_draw_separator('pixel_trans.gif', '9', '9'))) . '</form>';
?>
</td>
                  <td class="entryListing-heading"><?php 
echo tep_draw_form('sort_projects_name', tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('sort_order' => $_POST['sort_order'] == 'projects_name asc' ? 'projects_name desc' : 'projects_name asc'), array('mPath', 'period'), 'hidden_field') . tep_href_submit(TEXT_ACTIVITY_PROJECTNAME, 'submitLinkInfoBoxHeading') . ($_POST['sort_order'] == 'projects_name asc' ? tep_image(DIR_WS_IMAGES . 'triangle_down.png') : ($_POST['sort_order'] == 'projects_name desc' ? tep_image(DIR_WS_IMAGES . 'triangle_up.png') : tep_draw_separator('pixel_trans.gif', '9', '9'))) . '</form><br>&nbsp;' . TEXT_ACTIVITY_ROLENAME;
?>
</td>
                  <td class="entryListing-heading"><?php 
echo TEXT_ACTIVITY_AMOUNT;
?>
</td>
                  <td class="entryListing-heading"><?php 
echo TEXT_ACTIVITY_UNIT;
?>
</td>
                  <td class="entryListing-heading"><?php 
echo TEXT_ACTIVITY_TRAVELDISTANCE;
?>
</td>
                  <td class="entryListing-heading"><?php 
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr class="header">
        <td valign="middle"><?php 
echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . COMPANY_BANNER, COMPANY_NAME) . '</a>';
?>
</td>
      </tr>
    </table>
    <table border="0" width="100%" cellspacing="0" cellpadding="1">
      <tr class="headerNavigation">
        <td class="headerNavigation">&nbsp;&nbsp;
          <?php 
if (isset($_SESSION['employee'])) {
    echo HEADER_TEXT_CURRENT_USER . $_SESSION['employee']->fullname . '&nbsp;&nbsp;&nbsp;';
    echo tep_draw_form('logout', tep_href_link(FILENAME_DEFAULT)) . tep_create_parameters(array('action' => 'logout'), null, 'hidden_field') . '[' . tep_href_submit(HEADER_TEXT_LOGOUT, 'submitLinkHeaderNavigation') . ']</form>';
} else {
    echo HEADER_TEXT_NO_CURRENT_USER;
}
?>
        </td>
        <td align="right" class="headerNavigation">&nbsp;&nbsp;</td>
      </tr>
    </table>

<?php 
if (isset($_POST['error_message']) && tep_not_null($_POST['error_message'])) {
    ?>
    <table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr class="headerError">
        <td class="headerError"><?php 
for ($counter = $calendar_start; $counter <= $calendar_end; $counter++, $calendar_day++, $colindex++) {
    if ($colindex % 7 == 0) {
        ?>
          </tr>
          <tr>
        <?php 
    }
    echo tep_draw_form('select_day_' . $calendar_day, tep_href_link(FILENAME_TIMEREGISTRATION)) . tep_create_parameters(array('mPath' => '200', 'selected_date' => tep_datetouts('%Y-%m-%d', $_SESSION['timesheet']->start_date, $calendar_day - 1), 'action' => 'select_project'), array('period', 'sort_order', 'activity_id'), 'hidden_field');
    ?>
          <td class="<?php 
    echo $counter == $today ? 'calendar-today' : ($colindex % 7 >= 0 && $colindex % 7 <= 4 ? 'calendar-weekday' : 'calendar-weekend');
    ?>
" align="center">
            <?php 
    //echo '<a href=' . tep_href_link(FILENAME_TIMEREGISTRATION, tep_create_parameters(array('mPath'=>'21','selected_date'=>tep_datetouts('%Y-%m-%d', $_SESSION['timesheet']->start_date, $calendar_day - 1),'action'=>'select_project'), array('period', 'activity_id'))) . '>' . $calendar_day . '</a>';
    echo tep_href_submit($calendar_day);
    ?>
          </td>
        </form>
      <?php 
}
// Walk the rest of the cells to complete the current row
for ($restindex = $colindex % 7; $restindex > 0 && $restindex <= 6; $restindex++) {
    ?>
        <td class="<?php 
    echo $restindex >= 0 && $restindex <= 4 ? 'calendar-notavailable' : 'calendar-notavailable';
    ?>
" align="center">&nbsp;</td>
      <?php 
}
?>