示例#1
0
 public static function get(TS_User &$current_user, $selected_page, TS_Module_HRM_Employee &$employee = null)
 {
     // check for provided objects
     self::$employee =& $employee;
     if (!self::$employee) {
         self::$employee = new TS_Module_HRM_Employee();
     }
     // set current page and get all existing pages array
     self::$selected_page = $selected_page;
     self::$module_pages_ar = self::getPageNamesList();
     // build 'employees_overview' link
     if ($current_user->hasAccess('Main Menu', 'Personeel Vrij Planning')) {
         //self::addTab('employees_overview', 'overview');
     }
     // build 'edit_employee' link
     if (self::$employee->id && self::$employee->isValidID() && self::$employee->hasEditAccess($current_user) && $current_user->hasAccess('Personeel Vrij Planning', 'edit_employee_leaves')) {
         self::addTab('edit_employee', 'edit_item', true);
     }
     // build 'planning_overview' link
     if ($current_user->hasAccess('Main Menu', 'Personeel Vrij Planning')) {
         self::addTab('planning_overview', 'overview');
     }
     // build tabs list
     $tabs_li_ar = array();
     foreach (self::$tabs_links_ar as $page_link) {
         $tabs_li_ar[] = HTML::Li($page_link, '', in_array('selected_tab', $page_link->class) ? 'selected_tab' : '');
     }
     // add non-existing page if provided, and add selected page to page title
     if (!array_key_exists(self::$selected_page, self::$module_pages_ar)) {
         self::$current_page_subtitle_ar[] = self::$selected_page;
         $tabs_li_ar[] = HTML::Li(HTML::A(self::$selected_page, '', 'selected_tab'), '', 'selected_tab');
     }
     // build and return list
     if (!$tabs_li_ar) {
         return '';
     }
     return self::getLocalStyleScript() . self::getJquery() . HTML::Div(HTML::Ul(implode('', $tabs_li_ar)), 'tabs_container', 'clearfix');
 }
示例#2
0
    case 'set_employee_leave_field_value':
        $selected_leave_id = !empty($_REQUEST['record_id']) ? $_REQUEST['record_id'] : 0;
        $field_name = !empty($_REQUEST['field_name']) ? strtolower($_REQUEST['field_name']) : die;
        $field_value = isset($_REQUEST['field_value']) ? trim($_REQUEST['field_value']) : '';
        if (in_array($field_name, array('leave_start_date', 'leave_end_date')) && !$field_value) {
            $field_value = null;
        }
        die(TS_DB_HRM_PresencePlanning_EmployeeLeaves::update($selected_leave_id, array($field_name => $field_value)));
    case 'ajax_set_employee_presence_value':
        $field_value = isset($_REQUEST['field_value']) ? strtoupper(trim($_REQUEST['field_value'])) : '';
        $pdo_parameters_ar = array('employee_id' => $employee->id, 'presence_value_date' => !empty($_REQUEST['presence_date']) ? $_REQUEST['presence_date'] : null, 'num_worked_hours' => filter_var($field_value, FILTER_SANITIZE_NUMBER_INT), 'presence_value' => in_array($field_value, TS_Module_HRM_PresencePlanning_Constants::getPresenceTextOptions()) ? $field_value : '');
        // delete record when no value is provided, or update otherwise
        if (strlen($field_value) > 0) {
            die(TS_DB_HRM_PresencePlanning_EmployeePresenceValues::store($current_user, $pdo_parameters_ar));
        }
        die(TS_DB_HRM_PresencePlanning_EmployeePresenceValues::destroy($employee->id, $pdo_parameters_ar['presence_value_date']));
    default:
        $show_tabmenu = $show_header = true;
        $page_content_ar[] = HTML::H3('Sorry, de opgevraagde pagina bestaat niet.', '', 'center');
}
// show general page header
if ($show_header) {
    include_once $_SERVER['DOCUMENT_ROOT'] . '/layout/header.php';
    $page_content_ar[] = '</body></html>';
}
// show tabs selection
if ($show_tabmenu) {
    echo TS_Module_HRM_PresencePlanning_TabMenu::get($current_user, CURRENT_PAGE_NAME, $employee);
}
// Show any page content
echo implode('', $page_content_ar);