function reDirect($getArr, $postArr, $object = null)
 {
     $form_creator = new FormCreator($getArr, $postArr);
     if ($_SESSION['isAdmin'] !== 'Yes') {
         trigger_error("Unauthorized access", E_USER_NOTICE);
     }
     switch ($getArr['repcode']) {
         case 'EMPDEF':
             //if ()
             $form_creator->formPath = '/templates/report/emprepinfo.php';
             $form_creator->popArr['arrAgeSim'] = array('Less Than' => '>', 'Greater Than' => '<', 'Range' => 'range');
             //$form_creator->popArr['arrEmpType']= array( 'Permanent', 'Expatriate', 'Contract', 'Temporary' , 'Others');
             $form_creator->popArr['arrSerPer'] = array('Less Than' => '>', 'Greater Than' => '<', 'Range' => 'range');
             $form_creator->popArr['arrJoiDat'] = array('Joined After' => '>', 'Joined Before' => '<', 'Joined In Between' => 'range');
             $report = new EmpReport();
             $empinfo = new EmpInfo();
             $edu = new Education();
             $jobtit = new JobTitle();
             $salgrd = new SalaryGrades();
             $empstat = new EmploymentStatus();
             $langObj = new LanguageInfo();
             $skillObj = new Skills();
             $form_creator->popArr['grdlist'] = $salgrd->getSalGrdCodes();
             $form_creator->popArr['edulist'] = $edu->getAllEducation();
             $form_creator->popArr['deslist'] = $jobtit->getJobTit();
             $form_creator->popArr['arrEmpType'] = $empstat->getEmpStat();
             $form_creator->popArr['languageList'] = $langObj->getLang();
             $form_creator->popArr['skillList'] = $skillObj->getSkillCodes();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $edit = $report->filterReport($getArr['id']);
                 $criteria_value = explode('|', $edit[0][2]);
                 for ($c = 0; count($criteria_value) > $c; $c++) {
                     $crit_data = explode("=", $criteria_value[$c]);
                     $criteriaChkBox[$c] = $crit_data[0];
                     for ($d = 1; count($crit_data) > $d; $d++) {
                         $crit_form_data[$crit_data[0]][$d - 1] = $crit_data[$d];
                     }
                 }
                 $form_creator->popArr['editCriteriaChk'] = $criteriaChkBox;
                 $form_creator->popArr['editCriteriaData'] = $crit_form_data;
                 $form_creator->popArr['fieldList'] = explode('|', $edit[0][3]);
             }
             if ($object != null) {
                 $form_creator->popArr['empqual'] = $empqual->getQualifications($object->TypeCode);
             }
             break;
         case 'EMPVIEW':
             $report = new EmpReport();
             $repgen = new ReportGenerator();
             $edit = $report->filterReport($getArr['id']);
             $repgen->reportId = $edit[0][0];
             /* TODO: The following actions should be moved to model class */
             $criteria = explode('|', $edit[0][2]);
             $criteriaCount = count($criteria);
             for ($c = 0; $criteriaCount > $c; $c++) {
                 $crit_value = explode("=", $criteria[$c]);
                 $repgen->setCriteria($crit_value[0], '');
                 $criteriaValueCount = count($crit_value);
                 for ($d = 1; $criteriaValueCount > $d; $d++) {
                     if ($d == count($crit_value) - 1) {
                         $repgen->setCriteria($crit_value[0], $crit_value[$d], true);
                     } else {
                         $repgen->setCriteria($crit_value[0], $crit_value[$d] . "|", true);
                     }
                 }
             }
             $field = explode('|', $edit[0][3]);
             $fieldCount = count($field);
             for ($c = 0; $fieldCount > $c; $c++) {
                 $repgen->setField($field[$c], 1);
             }
             $sqlQ = $repgen->buildReportQuery();
             $arrayDispList = $repgen->buildDisplayList($sqlQ);
             $employee = array();
             if (is_array($arrayDispList)) {
                 $employee = current($arrayDispList);
             }
             $columns = count($employee);
             $rows = count($arrayDispList);
             $objs['reportName'] = $edit[0][1];
             $objs['arrayDispList'] = $arrayDispList;
             $objs['headerNames'] = $repgen->getHeaders();
             $objs['replacements'] = array('directReportingMode' => EmpRepTo::REPORTING_MODE_DIRECT, 'indirectReportingMode' => EmpRepTo::REPORTING_MODE_INDIRECT);
             $templatePath = '/templates/report/report.php';
             $template = new TemplateMerger($objs, $templatePath, null, null);
             $template->display();
             return;
             break;
         case 'RUG':
             $form_creator->formPath = '/templates/report/repusg.php';
             $report = new EmpReport();
             $emprepgroup = new EmpRepUserGroup();
             $form_creator->popArr['report'] = $report->filterReport($getArr['id']);
             $form_creator->popArr['usgAll'] = $emprepgroup->getAllUserGroups();
             $form_creator->popArr['repUsgAss'] = $emprepgroup->getAssignedUserGroup($getArr['id']);
             $form_creator->popArr['usgUnAss'] = $emprepgroup->getUnAssUserGroups($getArr['id']);
             break;
     }
     $form_creator->display();
 }
 function reDirect($getArr, $postArr, $object = null)
 {
     $form_creator = new FormCreator($getArr, $postArr);
     if ($_SESSION['isAdmin'] !== 'Yes') {
         trigger_error("Unauthorized access", E_USER_NOTICE);
     }
     switch ($getArr['repcode']) {
         case 'EMPDEF':
             //if ()
             $form_creator->formPath = '/templates/report/emprepinfo.php';
             $form_creator->popArr['arrAgeSim'] = array('Less Than' => '>', 'Greater Than' => '<', 'Range' => 'range');
             //$form_creator->popArr['arrEmpType']= array( 'Permanent', 'Expatriate', 'Contract', 'Temporary' , 'Others');
             $form_creator->popArr['arrSerPer'] = array('Less Than' => '>', 'Greater Than' => '<', 'Range' => 'range');
             $form_creator->popArr['arrJoiDat'] = array('Joined After' => '>', 'Joined Before' => '<', 'Joined In Between' => 'range');
             $report = new EmpReport();
             $empinfo = new EmpInfo();
             $edu = new Education();
             $jobtit = new JobTitle();
             $salgrd = new SalaryGrades();
             $empstat = new EmploymentStatus();
             $langObj = new LanguageInfo();
             $skillObj = new Skills();
             $form_creator->popArr['grdlist'] = $salgrd->getSalGrdCodes();
             $form_creator->popArr['edulist'] = $edu->getAllEducation();
             $form_creator->popArr['deslist'] = $jobtit->getJobTit();
             $form_creator->popArr['arrEmpType'] = $empstat->getEmpStat();
             $form_creator->popArr['languageList'] = $langObj->getLang();
             $form_creator->popArr['skillList'] = $skillObj->getSkillCodes();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $edit = $report->filterReport($getArr['id']);
                 $criteria_value = explode('|', $edit[0][2]);
                 for ($c = 0; count($criteria_value) > $c; $c++) {
                     $crit_data = explode("=", $criteria_value[$c]);
                     $criteriaChkBox[$c] = $crit_data[0];
                     for ($d = 1; count($crit_data) > $d; $d++) {
                         $crit_form_data[$crit_data[0]][$d - 1] = $crit_data[$d];
                     }
                 }
                 $form_creator->popArr['editCriteriaChk'] = $criteriaChkBox;
                 $form_creator->popArr['editCriteriaData'] = $crit_form_data;
                 $form_creator->popArr['fieldList'] = explode('|', $edit[0][3]);
             }
             if ($object != null) {
                 $form_creator->popArr['empqual'] = $empqual->getQualifications($object->TypeCode);
             }
             break;
         case 'EMPVIEW':
             $report = new EmpReport();
             $repgen = new ReportGenerator();
             $form_creator->popArr['editArr'] = $edit = $report->filterReport($getArr['id']);
             $repgen->repID = $edit[0][0];
             $repgen->repName = $edit[0][1];
             $criteria = explode('|', $edit[0][2]);
             for ($c = 0; count($criteria) > $c; $c++) {
                 $crit_value = explode("=", $criteria[$c]);
                 $repgen->criteria[$crit_value[0]] = '';
                 for ($d = 1; count($crit_value) > $d; $d++) {
                     if ($d == count($crit_value) - 1) {
                         $repgen->criteria[$crit_value[0]] .= $crit_value[$d];
                     } else {
                         $repgen->criteria[$crit_value[0]] .= $crit_value[$d] . "|";
                     }
                 }
             }
             $field = explode('|', $edit[0][3]);
             $empNoField = false;
             for ($c = 0; count($field) > $c; $c++) {
                 $repgen->field[$field[$c]] = 1;
                 if ($field[$c] == 'EMPNO') {
                     $empNoField = true;
                 }
             }
             $repgen->field['EMPNO'] = 1;
             $sqlQ = $repgen->reportQueryBuilder();
             //echo $sqlQ."<br/>";
             $dbConnection = new DMLFunctions();
             $message2 = $dbConnection->executeQuery($sqlQ);
             $i = 0;
             while ($line = mysql_fetch_array($message2, MYSQL_NUM)) {
                 for ($c = 0; count($repgen->field) * 2 > $c; $c += 2) {
                     $arrayDispList[$line[0]][$c / 2][$line[$c]] = $line[$c + 1];
                 }
                 $i++;
             }
             //print_r($arrayDispList);
             if (!isset($arrayDispList)) {
                 $arrayDispList = null;
             }
             $repgen->reportDisplay($arrayDispList, $empNoField);
             return;
             break;
         case 'RUG':
             $form_creator->formPath = '/templates/report/repusg.php';
             $emprepgroup = new EmpRepUserGroup();
             $form_creator->popArr['repDet'] = $emprepgroup->getReportInfo();
             $form_creator->popArr['usgAll'] = $emprepgroup->getAllUserGroups();
             $form_creator->popArr['repUsgAss'] = $emprepgroup->getAssignedUserGroup($getArr['id']);
             $form_creator->popArr['usgUnAss'] = $emprepgroup->getUnAssUserGroups($getArr['id']);
             break;
     }
     $form_creator->display();
 }