Exemplo n.º 1
0
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
     // Create the branches select
     require_once $path . "module_hcd_tools.php";
     eF_getRights();
     $company_branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "", "father_branch_ID ASC,branch_ID ASC");
     if ($_SESSION['s_type'] != 'administrator' && $currentEmployee->isSupervisor()) {
         //this applies to supervisors only
         foreach ($company_branches as $key => $value) {
             if (!in_array($value['branch_ID'], $allowedBranches)) {
                 unset($company_branches[$key]);
             }
         }
         $company_branches = array_values($company_branches);
     }
     $filter_branches = eF_createBranchesTreeSelect($company_branches, 4);
     $smarty->assign("T_BRANCHES", $filter_branches);
     $job_descriptions = eF_getTableData("module_hcd_job_description", "description,job_description_ID,branch_ID", "", "description ASC");
     if ($_SESSION['s_type'] != 'administrator' && $currentEmployee->isSupervisor()) {
         //this applies to supervisors only
         foreach ($job_descriptions as $key => $value) {
             if (!in_array($value['branch_ID'], $allowedBranches)) {
                 unset($job_descriptions[$key]);
             }
         }
         $job_descriptions = array_values($job_descriptions);
     }
     $job_des = array();
     foreach ($job_descriptions as $key => $value) {
         if (empty($job_des[$key])) {
             $job_des[$value['description']] = $value['job_description_ID'];
Exemplo n.º 2
0
 $form->addRule('duration', _THEFIELD . ' "' . _AVAILABLEFOR . '" ' . _MUSTBENUMERIC, 'numeric', null, 'client');
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
     $currentEmployee = $currentUser->aspects['hcd'];
     $_SESSION['employee_type'] = $currentEmployee->getType();
     require_once "../libraries/module_hcd_tools.php";
     if ($currentEmployee->getType() == _SUPERVISOR) {
         $branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "branch_ID IN (" . implode(",", $currentEmployee->supervisesBranches) . ")", "father_branch_ID ASC,branch_ID ASC");
         // Show only existing branches
         $only_existing = 1;
     } else {
         $branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "", "father_branch_ID ASC,branch_ID ASC");
         // Show all branches
         $only_existing = 0;
     }
     $form->addElement('select', 'branches_ID', _LOCATIONBRANCH, eF_createBranchesTreeSelect($branches, $only_existing), 'class = "inputText"');
 }
 #cpp#endif
 if (isset($_GET['edit_lesson'])) {
     //If we are editing a lesson, we set the default form values to the ones stored in the database
     $editLesson = new EfrontLesson($_GET['edit_lesson']);
     if ($editLesson->lesson['creator_LOGIN'] != $_SESSION['s_login']) {
         throw new Exception(_UNAUTHORIZEDACCESS);
     }
     $form->setDefaults(array('name' => $editLesson->lesson['name'], 'active' => $editLesson->lesson['active'], 'show_catalog' => $editLesson->lesson['show_catalog'], 'course_only' => $editLesson->lesson['course_only'], 'directions_ID' => $editLesson->lesson['directions_ID'], 'languages_NAME' => $editLesson->lesson['languages_NAME'], 'duration' => $editLesson->lesson['duration'] ? $editLesson->lesson['duration'] : '', 'share_folder' => $editLesson->lesson['share_folder'] ? $editLesson->lesson['share_folder'] : 0, 'max_users' => $editLesson->lesson['max_users'] ? $editLesson->lesson['max_users'] : null, 'price' => $editLesson->lesson['price'], 'recurring' => $editLesson->options['recurring'], $editLesson->options['recurring'] . '_duration' => $editLesson->options['recurring_duration']));
     if ($editLesson->lesson['share_folder']) {
         $shareFolderLesson = new EfrontLesson($editLesson->lesson['share_folder']);
         $smarty->assign("T_SHARE_FOLDER_WITH", $shareFolderLesson->lesson['name']);
     }
     if ($editLesson->lesson['course_only'] && sizeof($editLesson->getCourses()) > 0 || !$editLesson->lesson['course_only']) {
         $result = eF_getTableData("users_to_lessons", "count(*)", "lessons_ID={$editLesson->lesson['id']} and archive=0");
Exemplo n.º 3
0
        $options = array(array('image' => '16x16/scorm.png', 'title' => _SEARCHFORUSER, 'link' => $_SESSION['s_type'] . '.php?ctg=search_users', 'selected' => true), array('image' => '16x16/glossary.png', 'title' => _SEARCHCOURSEUSERS, 'link' => 'administrator.php?ctg=search_courses', 'selected' => false));
        //} #cpp#endif
        $smarty->assign("T_TABLE_OPTIONS", $options);
    }
}
/* Create the selection criteria form */
//$form = new HTML_QuickForm("reports_form", "post", $_SESSION['s_type'].".php?ctg=module_hcd&op=reports&search=1&branch_ID=".$_GET['branch_ID']."&job_description_ID=".$_GET['job_description_ID']."&skill_ID=".$_GET['skill_ID'], "", null, true);
$form = new HTML_QuickForm("reports_form", "post", $_SESSION['s_type'] . ".php?ctg=search_users&search=1", "", "onsubmit = 'return(false)'", true);
$form->addElement('radio', 'criteria', null, null, 'all_criteria', 'checked = "checked" id="all_criteria" onclick="javascript:refreshResults()"');
$form->addElement('radio', 'criteria', null, null, 'any_criteria', 'id="any_criteria" onclick="javascript:refreshResults()"');
/* Get data for creating the selects */
if (G_VERSIONTYPE == 'enterprise') {
    #cpp#ifdef ENTERPRISE
    /* Braches (in hierarchical form) */
    //$branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID","","father_branch_ID ASC,branch_ID ASC");
    $branches_list = eF_createBranchesTreeSelect(false, 6);
    $branches_list[0] = _DONTTAKEINTOACCOUNT;
    $form->addElement('select', 'search_branch', _WORKINGATBRANCH, $branches_list, 'id = "search_branch" class = "inputSelectMed" onchange="javascript:refreshResults()"');
    // If a branch is selected then the form will reload on clicking the checkbox.
    if (isset($_GET['branch_ID'])) {
        $onclick_event = ' onclick = "" ';
    } else {
        $onclick_event = '';
    }
    $form->addElement('advcheckbox', 'include_subbranches', _INCLUDESUBBRANCHES, null, 'class = "inputCheckbox" id="include_subbranchesId" onClick="javascript:includeSubbranches()"');
    /* Job descriptions (all different job descriptions irrespective of the branch they belong to) */
    if (isset($_GET['branch_ID']) && $_GET['branch_ID'] != "" && $_GET['branch_ID'] > 0) {
        $activeBranch = new EfrontBranch($_GET['branch_ID']);
        $job_description_list = $activeBranch->createJobDescriptionsSelect();
        $job_description_list[0] = _DONTTAKEINTOACCOUNT;
    } else {
         // Show only existing branches
         $only_existing = 1;
     } else {
         $branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "", "father_branch_ID ASC,branch_ID ASC");
         // Show all branches
         $only_existing = 0;
     }
     $branchSelect = HTML_QuickForm::createElement('select', 'branches_ID', _LOCATIONBRANCH, eF_createBranchesTreeSelect($branches, $only_existing), 'class = "inputText"');
     if (isset($_GET['edit_course'])) {
         $editCourse = new EfrontCourse($_GET['edit_course']);
         $result = eF_getTableDataFlat("module_hcd_course_to_branch mb, module_hcd_branch b", "mb.branches_ID, b.name", "b.branch_ID=mb.branches_ID and mb.courses_ID=" . $editCourse->course['id']);
         if (sizeof($result['branches_ID']) > 0) {
             $form->setDefaults(array("branches_ID" => $result['branches_ID'][0]));
             if (sizeof($result['branches_ID']) > 1) {
                 $smarty->assign("T_MORE_LOCATIONS", implode(", ", $result['name']));
                 $branchSelect = HTML_QuickForm::createElement('select', 'branches_ID', _LOCATIONBRANCH, eF_createBranchesTreeSelect($branches, $only_existing), 'class = "inputText" disabled = "true"');
             }
         }
     }
     $form->addElement($branchSelect);
     $result = eF_getTableData("module_hcd_employee_works_at_branch ewb, users u", "u.login", "u.archive=0 and ewb.users_LOGIN=u.login and ewb.supervisor=1");
     $supervisors = array('' => '');
     foreach ($result as $value) {
         $supervisors[$value['login']] = formatLogin($value['login']);
     }
     if (sizeof($supervisors) > 1) {
         $form->addElement('select', 'supervisor_LOGIN', _ASSIGNMENTAPPROVEDBY, $supervisors, 'class = "inputText"');
     }
 }
 #cpp#endif
 $form->addElement('text', 'calendar_event', _CALENDAREVENT, 'class = "inputText"');
Exemplo n.º 5
0
$form->addElement('radio', 'recipients', null, null, 'specific_user', 'onclick = "eF_js_selectRecipients(\'specific_user\')"');
//'onclick = "document.getElementById(\'lesson_recipients\').disabled = \'disabled\';document.getElementById(\'user_type_recipients\').disabled = \'disabled\';document.getElementById(\'user_recipients\').disabled = \'\'"');
$form->addElement('select', 'user', null, $users, 'id = "user_recipients" class = "inputSelect" disabled = "disabled"');
$form->addRule('user', _INVALIDFIELDDATA, 'checkParameter', 'login');
$form->setDefaults(array('recipients' => 'active_users'));
// GGET DATA FOR CREATING THE SELECTS
if (G_VERSIONTYPE == 'enterprise') {
    #cpp#ifdef ENTERPRISE
    /* **************************************************** */
    /** MODULE HCD: Insert new radio buttons for more recipient options **/
    /* **************************************************** */
    $branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "", "father_branch_ID ASC,branch_ID ASC");
    if (!empty($branches)) {
        $branches_list = array();
        require_once "../libraries/module_hcd_tools.php";
        $branches_list = eF_createBranchesTreeSelect($branches, 1);
    } else {
        $branches_list = array("0" => _NOBRANCHESHAVEBEENREGISTERED);
        //        $branches_list[0] = _NOBRANCHESHAVEBEENREGISTERED;
        $disable_branches = "disabled=\"disabled\"";
    }
    //TODO:PROBLEM
    //pr($branches_list);
    $job_descriptions = eF_getTableData("module_hcd_job_description", "distinct description", "");
    if (!empty($job_descriptions)) {
        $job_description_list = array("0" => _ANYJOBDESCRIPTION);
        foreach ($job_descriptions as $job_description) {
            $log = $job_description['description'];
            $job_description_list["{$log}"] = $job_description['description'];
        }
    } else {