Example #1
0
         $form->addRule($field['name'], _INVALIDFIELDDATA, 'checkRule', $field['rule']);
     }
     if ($field['type'] == 'date' && $field['default_value'] == 0) {
         $form->setDefaults(array($field['name'] => time()));
     } else {
         $form->setDefaults(array($field['name'] => $field['default_value']));
     }
 } elseif ($field['type'] == 'branchinfo') {
     if (G_VERSIONTYPE == 'enterprise') {
         #cpp#ifdef ENTERPRISE
         $loadScripts[] = 'includes/index';
         $options = unserialize($field['options']);
         //$branches1 = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID","","father_branch_ID ASC,branch_ID ASC");
         //$branches = eF_createBranchesTreeSelect($branches1, 0);
         $branchesTree = new EfrontBranchesTree();
         $pathStrings = $branchesTree->toPathStringShortened();
         if (!empty($pathStrings)) {
             $branches = array(0 => '') + $pathStrings;
         } else {
             $branches = array(0 => '');
         }
         /** Create the branches selects according to this employee's data **/
         if (!empty($branches)) {
             $userProfileFields[] = $field['name'] . '_branches';
             $form->addElement('select', $field['name'] . '_branches', $options['name'], $branches, 'class = "inputSelect" id="' . $field['name'] . '_branches" name="' . $field['name'] . '_branches"  onchange="javascript:change_branch(\'' . $field['name'] . '_branches\', \'' . $field['name'] . '_jobs\');change_supervisors(\'' . $field['name'] . '_branches\',\'' . $field['name'] . '_supervisors\');"');
             if ($field['mandatory']) {
                 $form->addRule($field['name'] . '_branches', _THEFIELD . ' ' . $options['name'] . ' ' . _ISMANDATORY, 'required', null, 'client');
             }
             //IE does not support options.disabled.... Special treatment needed
             if ($options['job']['description'] != "") {
                 $userProfileFields[] = $field['name'] . '_jobs';
Example #2
0
 } else {
     if ($position3 = strpos($previous_url, "show_profile")) {
         $form->setDefaults(array('previous_url' => "?new_message.php"));
     } else {
         $form->setDefaults(array('previous_url' => $previous_url));
     }
 }
 /* **************************************************** */
 /** MODULE HCD: Insert new radio buttons for more recipient options **/
 /* **************************************************** */
 // GGET DATA FOR CREATING THE SELECTS
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
     require_once $path . "module_hcd_tools.php";
     $branchesTree = new EfrontBranchesTree();
     $branches_list = $branchesTree->toPathStringShortened();
     if (!empty($branches_list)) {
         $smarty->assign("T_BRANCHES", 1);
         if ($_SESSION['s_type'] != 'administrator') {
             if ($currentEmployee->isSupervisor()) {
                 foreach ($currentEmployee->getSupervisedBranches() as $value) {
                     $employee_branches[] = $value['branch_ID'];
                 }
             } else {
                 $employee_branches = $currentEmployee->getBranches(true);
             }
             if (!empty($employee_branches)) {
                 foreach ($branches_list as $key => $value) {
                     if (!in_array($key, $employee_branches)) {
                         unset($branches_list[$key]);
                     }