Example #1
0
 public function parseAddData($postArr)
 {
     $csvImport = new CSVImport();
     if (isset($postArr['cmbImportType']) && !empty($postArr['cmbImportType'])) {
         $csvImport->setImportType(trim($postArr['cmbImportType']));
     }
     if (isset($_FILES['importFile']) && $_FILES['importFile']['size'] > 0) {
         $csvImport->setFileName($_FILES['importFile']['tmp_name']);
     }
     return $csvImport;
 }
 function reDirect($getArr, $object = null)
 {
     $form_creator = new FormCreator($getArr);
     switch ($getArr['uniqcode']) {
         case 'BNK':
             $form_creator->formPath = '/templates/eimadmin/bankinformation.php';
             $bankinfo = new BankInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $bankinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $bankinfo->filterBankInfo($getArr['id']);
             }
             break;
         case 'BCH':
             $form_creator->formPath = '/templates/eimadmin/branches.php';
             $brch = new Branches();
             $bank = new BankInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $brch->getLastRecord();
                 $form_creator->popArr['bankcode'] = $bank->getBankCodes();
             } elseif ($getArr['captuIMPremode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $brch->filterBranches($getArr['id']);
                 $form_creator->popArr['bankcode'] = $bank->getBankCodes();
             }
             break;
         case 'TAX':
             $form_creator->formPath = '/templates/eimadmin/taxinformation.php';
             $taxinfo = new TaxInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $taxinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $taxinfo->filterTaxInfo($getArr['id']);
             }
             break;
         case 'CCB':
             $form_creator->formPath = '/templates/eimadmin/cashben.php';
             $cashben = new CashBen();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $cashben->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $cashben->filterCashBenefits($getArr['id']);
             }
             break;
         case 'BBS':
             $form_creator->formPath = '/templates/eimadmin/cashbensal.php';
             $salgrd = new SalaryGrades();
             $cashbensal = new CashBenSalary();
             $cashben = new CashBen();
             $form_creator->popArr['salDet'] = $salgrd->filterSalaryGrades($getArr['id']);
             $form_creator->popArr['benListAll'] = $cashben->getAllCashBenefits();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['editID'];
                 $arr[1] = $getArr['id'];
                 $form_creator->popArr['editArr'] = $cashbensal->filterCashBenefits($arr);
             } else {
                 $form_creator->popArr['benListUnAss'] = $cashben->getCashBenCodes($getArr['id']);
             }
             $form_creator->popArr['benListAss'] = $cashbensal->getAssCashBenefits($getArr['id']);
             break;
         case 'COS':
             $form_creator->formPath = '/templates/eimadmin/costcenters.php';
             $cost = new CostCenter();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $cost->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $cost->filterCostCenter($getArr['id']);
             }
             break;
         case 'COU':
             $form_creator->formPath = '/templates/eimadmin/countryinformation.php';
             $country = new CountryInfo();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $country->filterCountryInfo($getArr['id']);
             }
             break;
         case 'CUR':
             $form_creator->formPath = '/templates/eimadmin/currencytypes.php';
             $currency = new CurrencyTypes();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $currency->filterCurrencyTypes($getArr['id']);
             }
             break;
         case 'DWT':
             $form_creator->formPath = '/templates/eimadmin/dwellinginformation.php';
             $dwinfo = new DwellingType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $dwinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $dwinfo->filterDwellingType($getArr['id']);
             }
             break;
         case 'ELE':
             $form_creator->formPath = '/templates/eimadmin/electorateinformation.php';
             $eleinfo = new ElectorateInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $eleinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $eleinfo->filterElectorateInfo($getArr['id']);
             }
             break;
         case 'EMC':
             $form_creator->formPath = '/templates/eimadmin/empcatinfo.php';
             $empcatinfo = new EmployeeCat();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $empcatinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $empcatinfo->filterEmployeeCat($getArr['id']);
             }
             break;
         case 'EMG':
             $form_creator->formPath = '/templates/eimadmin/employeegroups.php';
             $empgrpinfo = new EmployeeGroup();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $empgrpinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $empgrpinfo->filterEmployeeGroup($getArr['id']);
             }
             break;
         case 'ETY':
             $form_creator->formPath = '/templates/eimadmin/emptypes.php';
             $emptype = new EmployeeType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $emptype->getLastRecord();
             } elseif ($getArr['capturemIMPode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $emptype->filterEmployeeType($getArr['id']);
             }
             break;
         case 'EXC':
             $form_creator->formPath = '/templates/eimadmin/extracurractcat.php';
             $exccat = new ExtraCurrActCat();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $exccat->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $exccat->filterExtraCurrActCat($getArr['id']);
             }
             break;
         case 'DEF':
             $form_creator->formPath = '/templates/eimadmin/hierarchydef.php';
             $hidef = new HierarchyDefInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $hidef->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $hidef->filterHierarchyDefInfo($getArr['id']);
             }
             break;
         case 'CHI':
             $form_creator->formPath = '/templates/eimadmin/comphier.php';
             $cmphier = new CompHierachy();
             $hidef = new HierarchyDefInfo();
             $loc = new models_eimadmin_Location();
             $empinfo = new EmpInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $cmphier->getLastRecord();
                 $form_creator->popArr['hiercodes'] = $hidef->getHierachyCodes();
                 $form_creator->popArr['empcodes'] = $empinfo->getEmpCodes();
                 $form_creator->popArr['deflev'] = $cmphier->getHierachyDef();
                 $form_creator->popArr['loccodes'] = $loc->getLocCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $cmphier->filterCompHierachy($getArr['id']);
                 $form_creator->popArr['hiercodes'] = $cmphier->getHierachyCodes();
                 $form_creator->popArr['empcodes'] = $empinfo->getEmpCodes();
                 $form_creator->popArr['deflev'] = $cmphier->getHierachyDef();
                 $form_creator->popArr['loccodes'] = $loc->getLocCodes();
             }
             break;
         case 'LOC':
             $form_creator->formPath = '/templates/eimadmin/locations.php';
             $loc = new models_eimadmin_Location();
             $country = new CountryInfo();
             $form_creator->popArr['cntlist'] = $country->getCountryCodes();
             if ($getArr['capturemode'] == 'updatemode') {
                 $province = new ProvinceInfo();
                 $district = new DistrictInfo();
                 $form_creator->popArr['editArr'] = $edit = $loc->filterLocation($getArr['id']);
                 $form_creator->popArr['provlist'] = $province->getProvinceCodes($edit[0][2]);
                 $form_creator->popArr['districtlist'] = $district->getDistrictCodes($edit[0][3]);
             }
             break;
         case 'JDC':
             $form_creator->formPath = '/templates/eimadmin/jdcategory.php';
             $jdcat = new JDCategory();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $jdcat->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $jdcat->filterJDCategory($getArr['id']);
             }
             break;
         case 'MEM':
             $form_creator->formPath = '/templates/eimadmin/membershiptypes.php';
             $memtype = new MembershipType();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $memtype->filterMembershipType($getArr['id']);
             }
             break;
         case 'EMX':
             $form_creator->formPath = '/templates/eimadmin/emailConfiguration.php';
             $emailConfigObj = new EmailConfiguration();
             $form_creator->popArr['editArr'] = $emailConfigObj;
             break;
         case 'CSE':
             $form_creator->formPath = '/templates/eimadmin/dataExport.php';
             $csvExport = new CSVExport();
             $form_creator->popArr['exportTypes'] = $csvExport->getDefinedExportTypes();
             break;
         case 'IMP':
             if (isset($getArr['upload']) && $getArr['upload'] == 1) {
                 $form_creator->formPath = '/templates/eimadmin/dataUploadStatus.php';
                 $form_creator->popArr['uploadStatus'] = $object;
                 $form_creator->popArr['recordLimit'] = CSVSplitter::getRecordLimit();
                 $form_creator->popArr['delimiterLevels'] = AjaxCalls::getDelimiterLevelsArray(3);
             } else {
                 $form_creator->formPath = '/templates/eimadmin/dataImport.php';
                 $csvImport = new CSVImport();
                 $form_creator->popArr['importTypes'] = $csvImport->getDefinedImportTypes();
             }
             break;
         case 'ENS':
             $form_creator->formPath = '/templates/eimadmin/emailNotificationConfiguration.php';
             $emailNotificationConfObj = new EmailNotificationConfiguration($_SESSION['user']);
             $form_creator->popArr['editArr'] = $emailNotificationConfObj->fetchNotifcationStatus();
             break;
         case 'NAT':
             $form_creator->formPath = '/templates/eimadmin/nationalityinformation.php';
             $natinfo = new NationalityInfo();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $natinfo->filterNationalityInfo($getArr['id']);
             }
             break;
         case 'NCB':
             $form_creator->formPath = '/templates/eimadmin/noncashben.php';
             $noncashben = new NonCashBen();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $noncashben->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $noncashben->filterNonCashBenefits($getArr['id']);
             }
             break;
         case 'QLF':
             $form_creator->formPath = '/templates/eimadmin/qualificationtypes.php';
             $qualtype = new QualificationType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $qualtype->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $qualtype->filterQualificationType($getArr['id']);
             }
             break;
         case 'RTM':
             $form_creator->formPath = '/templates/eimadmin/ratingmethods.php';
             $rattype = new RatingTypes();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $rattype->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $rattype->filterRatingTypes($getArr['id']);
             }
             break;
         case 'RTE':
             $form_creator->formPath = '/templates/eimadmin/routeinformation.php';
             $rouinfo = new RouteInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $rouinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $rouinfo->filterRouteInfo($getArr['id']);
             }
             break;
         case 'SGR':
             $form_creator->formPath = '/templates/eimadmin/salarygrades.php';
             $salgrade = new SalaryGrades();
             $salcurdet = new SalCurDet();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $salgrade->filterSalaryGrades($getArr['id']);
                 $form_creator->popArr['assCurrency'] = $salcurdet->getAssSalCurDet($getArr['id']);
                 if (!isset($getArr['editID'])) {
                     $form_creator->popArr['unAssCurrency'] = $salcurdet->getUnAssSalCurDet($getArr['id']);
                 } else {
                     $arr[0] = $getArr['id'];
                     $arr[1] = $getArr['editID'];
                     $form_creator->popArr['editAssCurrency'] = $salcurdet->filterSalCurDet($arr);
                 }
             }
             break;
         case 'SKI':
             $form_creator->formPath = '/templates/eimadmin/skills.php';
             $skill = new Skills();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $skill->filterSkills($getArr['id']);
             }
             break;
         case 'ETH':
             $form_creator->formPath = '/templates/eimadmin/ethnicrace.php';
             $ethnicrace = new EthnicRace();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $ethnicrace->filterEthnicRace($getArr['id']);
             }
             break;
         case 'EXA':
             $form_creator->formPath = '/templates/eimadmin/extracurractinfo.php';
             $extcainfo = new ExtraCurActInfo();
             $excurac = new ExtraCurrActCat();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $extcainfo->getLastRecord();
                 $form_creator->popArr['getResultSet'] = $extcainfo->getExtraCatCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $extcainfo->filterExtraCurActInfo($getArr['id']);
                 $form_creator->popArr['getResultSet'] = $excurac->getExtraCatCodes();
             }
             break;
         case 'MME':
             $form_creator->formPath = '/templates/eimadmin/membershipinformation.php';
             $meminfo = new MembershipInfo();
             $memtype = new MembershipType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['getResultSet'] = $memtype->getMembershipTypeCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $meminfo->filterMembershipInfo($getArr['id']);
                 $form_creator->popArr['getResultSet'] = $memtype->getMembershipTypeCodes();
             }
             break;
         case 'JDK':
             $form_creator->formPath = '/templates/eimadmin/jdkra.php';
             $jdkr = new JDKra();
             $skill = new Skills();
             $jdtyp = new JDType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $jdkr->getLastRecord();
                 $form_creator->popArr['jdktyplist'] = $jdtyp->getJDTypeCodes();
                 $form_creator->popArr['sktyplist'] = $skill->getSkillCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $jdkr->filterJDKra($getArr['id']);
                 $form_creator->popArr['jdktyplist'] = $jdtyp->getJDTypeCodes();
                 $form_creator->popArr['sktyplist'] = $skill->getSkillCodes();
             }
             break;
         case 'LAN':
             $form_creator->formPath = '/templates/eimadmin/languageinformation.php';
             $laninfo = new LanguageInfo();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $laninfo->filterLanguageInfo($getArr['id']);
             }
             break;
         case 'RLG':
             $form_creator->formPath = '/templates/eimadmin/religioninformation.php';
             $relinfo = new ReligionInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $relinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $relinfo->filterReligionInfo($getArr['id']);
             }
             break;
         case 'SAT':
             $form_creator->formPath = '/templates/eimadmin/satutoryinfo.php';
             $satinfo = new SatutoryInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $satinfo->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $satinfo->filterSatutoryInfo($getArr['id']);
             }
             break;
         case 'UNI':
             $form_creator->formPath = '/templates/eimadmin/uniformtypes.php';
             $unitype = new UniformType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $unitype->getLastRecord();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $unitype->filterUniformType($getArr['id']);
             }
             break;
         case 'EXA':
             $form_creator->formPath = '/templates/eimadmin/extracurractinfo.php';
             $excurac = new ExtraCurActInfo();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $excurac->getLastRecord();
                 $form_creator->popArr['getResultSet'] = $excurac->getExtraCatCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $excurac->filterExtraCurActInfo($getArr['id']);
                 $form_creator->popArr['getResultSet'] = $excurac->getExtraCatCodes();
             }
             break;
         case 'EDU':
             $form_creator->formPath = '/templates/eimadmin/qualifications.php';
             $edu = new Education();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $edu->filterEducation($getArr['id']);
             }
             break;
         case 'JDT':
             $form_creator->formPath = '/templates/eimadmin/jdtypes.php';
             $jdtyp = new JDType();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $jdtyp->getLastRecord();
                 $form_creator->popArr['jdcatcodes'] = $jdtyp->getJDTypeCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $jdtyp->filterJDType($getArr['id']);
                 $form_creator->popArr['jdcatcodes'] = $jdtyp->getJDTypeCodes();
             }
             break;
         case 'SBJ':
             $form_creator->formPath = '/templates/eimadmin/subjectinformation.php';
             $subin = new SubjectInfo();
             $qualifi = new Qualifications();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $subin->getLastRecord();
                 $form_creator->popArr['getResultSet'] = $qualifi->getQualifiCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $subin->filterSubjectInfo($getArr['id']);
                 $form_creator->popArr['getResultSet'] = $qualifi->getQualifiCodes();
             }
             break;
         case 'SSK':
             $form_creator->formPath = '/templates/eimadmin/subskillinformation.php';
             $subsk = new SubSkillInfo();
             $skill = new Skills();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $subsk->getLastRecord();
                 $form_creator->popArr['getResultSet'] = $skill->getSkillCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $subsk->filterSubSkillInfo($getArr['id']);
                 $form_creator->popArr['getResultSet'] = $skill->getSkillCodes();
             }
             break;
         case 'CTT':
             $form_creator->formPath = '/templates/eimadmin/corptit.php';
             $corptit = new CorpTitle();
             $salgrd = new SalaryGrades();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $corptit->getLastRecord();
                 $form_creator->popArr['corptitles'] = $corptit->getCorpTitles();
                 $form_creator->popArr['salgrds'] = $corptit->getSalGrades();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $corptit->filterCorpTitles($getArr['id']);
                 $form_creator->popArr['corptitles'] = $corptit->getCorpTitles();
                 $form_creator->popArr['salgrds'] = $salgrd->getSalGrades();
             }
             break;
         case 'DSG':
             $form_creator->formPath = '/templates/eimadmin/designations.php';
             $desig = new Designations();
             $corptit = new CorpTitle();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['newID'] = $desig->getLastRecord();
                 $form_creator->popArr['corptitles'] = $corptit->getCorpTitles();
                 $form_creator->popArr['des'] = $desig->getDes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $desig->filterDesignations($getArr['id']);
                 $form_creator->popArr['corptitles'] = $corptit->getCorpTitles();
                 $form_creator->popArr['des'] = $desig->getDes();
             }
             break;
         case 'DIS':
             $form_creator->formPath = '/templates/eimadmin/districtinformation.php';
             $disinfo = new DistrictInfo();
             $prov = new ProvinceInfo();
             $country = new CountryInfo();
             $form_creator->popArr['countrylist'] = $country->getCountryCodes();
             if ($getArr['capturemode'] == 'addmode') {
                 if ($object != null) {
                     $form_creator->popArr['txtDistrictDesc'] = $object->txtDistrictDesc;
                     $form_creator->popArr['cmbCountry'] = $object->cmbCountry;
                     $form_creator->popArr['selProvince'] = $object->selProvince;
                     $form_creator->popArr['provlist'] = $prov->getProvinceCodes($object->cmbCountry);
                 }
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $editArr = $disinfo->filterDistrictInfo($getArr['id']);
                 if ($object != null) {
                     $form_creator->popArr['txtDistrictDesc'] = $object->txtDistrictDesc;
                     $form_creator->popArr['cmbCountry'] = $object->cmbCountry;
                     $form_creator->popArr['selProvince'] = $object->selProvince;
                     $form_creator->popArr['provlist'] = $prov->getProvinceCodes($object->cmbCountry);
                 } else {
                     $temp = $prov->filterGetProvinceCodeInfo($editArr[0][2]);
                     $form_creator->popArr['selcountry'] = $temp[0][2];
                     $form_creator->popArr['provlist'] = $prov->getProvinceCodes($temp[0][2]);
                 }
             }
             break;
         case 'NBS':
             $form_creator->formPath = '/templates/eimadmin/noncashbensal.php';
             $salgrd = new SalaryGrades();
             $noncashbensal = new NonCashBenSalary();
             $noncashben = new NonCashBen();
             $form_creator->popArr['salDet'] = $salgrd->filterSalaryGrades($getArr['id']);
             $form_creator->popArr['benListAll'] = $noncashben->getAllNonCashBenefits();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['editID'];
                 $arr[1] = $getArr['id'];
                 $form_creator->popArr['editArr'] = $noncashben->filterNonCashBenefits($arr);
             } else {
                 $form_creator->popArr['benListUnAss'] = $noncashben->getNonCashBenCodes($getArr['id']);
             }
             $form_creator->popArr['benListAss'] = $noncashbensal->getAssCashBenefits($getArr['id']);
             break;
         case 'DDI':
             $form_creator->formPath = '/templates/eimadmin/desdis.php';
             $desig = new Designations();
             $desdis = new DesDescription();
             $form_creator->popArr['desDet'] = $desig->getDes();
             $form_creator->popArr['desDisAss'] = $desdis->getAssigned($getArr['id']);
             if (isset($getArr['editID'])) {
                 $arr[1] = $getArr['id'];
                 $arr[0] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $desdis->filterJDKPI($arr);
             }
             if (isset($getArr['addForm']) && $getArr['addForm'] == 'ADD') {
                 $form_creator->popArr['desDisUnAss'] = $desdis->getGrouping($getArr['id']);
             }
             break;
         case 'DQA':
             $form_creator->formPath = '/templates/eimadmin/desqua.php';
             $desig = new Designations();
             $desqual = new DesQualification();
             $form_creator->popArr['desDet'] = $desig->getDes();
             $form_creator->popArr['qualListAll'] = $desqual->getAllQualifications();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $desqual->filterJDQual($arr);
             } else {
                 $form_creator->popArr['qualListUnAss'] = $desqual->getQual($getArr['id']);
             }
             $form_creator->popArr['qualListAss'] = $desqual->getAssJDQual($getArr['id']);
             break;
         case 'DQS':
             $form_creator->formPath = '/templates/eimadmin/desquasub.php';
             $desig = new Designations();
             $desqualsub = new DesQualSubject();
             $qualifi = new Qualifications();
             $form_creator->popArr['desDet'] = $desig->filterDesignations($getArr['id']);
             $form_creator->popArr['qualDet'] = $qualifi->getQualCodes();
             $form_creator->popArr['gradlist'] = $desqualsub->getRatGrds($getArr['QUA']);
             $form_creator->popArr['subDet'] = $desqualsub->getSubjectCodes();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $arr[2] = $getArr['QUA'];
                 $form_creator->popArr['editArr'] = $desqualsub->filterQuaSub($arr);
             } else {
                 $form_creator->popArr['sublist'] = $desqualsub->getSubjects($getArr['id'], $getArr['QUA']);
             }
             $form_creator->popArr['rset'] = $desqualsub->getAssQuaSub($getArr['id']);
             break;
         case 'RTG':
             $form_creator->formPath = '/templates/eimadmin/ratinggrade.php';
             $rattyp = new RatingTypes();
             $form_creator->popArr['ratDet'] = $rattyp->filterRatingTypes($getArr['id']);
             $ratgrd = new RatingGrade();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['editID'];
                 $arr[1] = $getArr['id'];
                 $form_creator->popArr['editArr'] = $ratgrd->filterRatGrd($arr);
             } else {
                 $form_creator->popArr['newID'] = $ratgrd->getLastRecord();
             }
             $form_creator->popArr['ratGrdAss'] = $ratgrd->getAssRatGrd($getArr['id']);
             break;
         case 'EEC':
             $form_creator->formPath = '/templates/eimadmin/eeojobcat.php';
             $eeojobcat = new EEOJobCat();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $eeojobcat->filterEEOJobCat($getArr['id']);
             }
             break;
         case 'LIC':
             $form_creator->formPath = '/templates/eimadmin/licenses.php';
             $licenses = new Licenses();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $licenses->filterLicenses($getArr['id']);
             }
             break;
         case 'CST':
             $form_creator->formPath = '/templates/eimadmin/compstruct.php';
             /*
             $hierachinfo = new HierarchyDefInfo();
             $comphier = new CompHierachy();
             $compstruct = new CompStruct();
             
             $form_creator->popArr['hierlist'] = $hierachinfo -> getHierarchyDef();
             $form_creator->popArr['compstruct'] = $comphier ->getAssCompHier(1,'');
             $form_creator->popArr['unAssCompStruct'] = $compstruct->getUnAssCompStruct('',1);
             */
             $locations = new models_eimadmin_Location();
             $countries = new CountryInfo();
             $form_creator->popArr['locations'] = $locations->getLocCodes();
             $form_creator->popArr['countries'] = $countries->getCountryCodes();
             break;
         case 'TCP':
             $form_creator->formPath = '/templates/eimadmin/companyProperty.php';
             $authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
             if (!isset($_GET['action'])) {
                 $empInfo = new EmpInfo();
                 if ($authorizeObj->isAdmin()) {
                     $form_creator->popArr['emplist'] = $empInfo->getListofEmployee();
                 } else {
                     $empReportTo = new EmpRepTo();
                     $form_creator->popArr['emplist'] = $empReportTo->getEmpSubDetails($_SESSION['empID']);
                     /* An element of the value from $empInfo->getListofEmployee() will contain
                      * an array with 6 elements. Values from $empReportTo->getEmpSubDetails() will
                      * only contain 3 elements. But there won't be a problem because only first 3 values
                      * will be used in the template
                      */
                 }
             }
             $compProp = new CompProperty();
             $propertyCount = count($compProp->getPropertyList());
             $pageNo = 1;
             if (isset($_REQUEST['pageNo'])) {
                 $pageNo = $_REQUEST['pageNo'];
             } else {
                 $pageNo = ceil($propertyCount / 10);
             }
             if ($authorizeObj->isAdmin()) {
                 $form_creator->popArr['properties'] = $compProp->getPropertyList($pageNo);
             } else {
                 $subordinateList = array();
                 foreach ($form_creator->popArr['emplist'] as $subordinate) {
                     $subordinateList[] = $subordinate[0];
                 }
                 $form_creator->popArr['properties'] = $compProp->getPropertyList($pageNo, $subordinateList, true);
             }
             $form_creator->popArr['allProperties'] = $compProp->getPropertyList();
             $form_creator->popArr['pageNo'] = $pageNo;
             $form_creator->popArr['recordCount'] = $propertyCount;
             $form_creator->popArr['authObj'] = $authorizeObj;
             break;
         case 'JOB':
             $form_creator->formPath = '/templates/eimadmin/jobtitle.php';
             $jobtitle = new JobTitle();
             $paygrade = new SalaryGrades();
             $jobtit_empstat = new JobTitEmpStat();
             $form_creator->popArr['paygrade'] = $paygrade->getSalGrades(true);
             $form_creator->popArr['jobSpecList'] = JobSpec::getAll();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $jobtitle->filterJobTitles($getArr['id']);
                 $form_creator->popArr['assEmploymentStat'] = $jobtit_empstat->getAssEmpStat($getArr['id']);
                 $form_creator->popArr['unAssEmploymentStat'] = $jobtit_empstat->getUnAssEmpStat($getArr['id']);
             }
             break;
         case 'SPC':
             $form_creator->formPath = '/templates/eimadmin/jobSpec.php';
             // Here we fetch all job specs for easier validation of duplicate names
             // Assuming it's unlikely that very large number of job specs will be defined.
             $form_creator->popArr['jobSpecList'] = JobSpec::getAll();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['jobSpec'] = JobSpec::getJobSpec($getArr['id']);
             } else {
                 $form_creator->popArr['jobSpec'] = new JobSpec();
             }
             break;
         case 'EST':
             $form_creator->formPath = '/templates/eimadmin/empstat.php';
             $empstat = new EmploymentStatus();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $empstat->filterEmpStat($getArr['id']);
             }
             break;
         case 'GEN':
             $form_creator->formPath = '/templates/eimadmin/geninfo.php';
             $geninfo = new GenInfo();
             $country = new CountryInfo();
             $province = new ProvinceInfo();
             $district = new DistrictInfo();
             $tabArr = $geninfo->filterGenInfo();
             $genInfoKeys = explode('|', $tabArr[0][0]);
             $genInfoValues = explode('|', $tabArr[0][1]);
             for ($c = 0; $genInfoKeys && count($genInfoKeys) > $c; $c++) {
                 $editArr[$genInfoKeys[$c]] = $genInfoValues[$c];
             }
             $form_creator->popArr['editArr'] = $editArr;
             $form_creator->popArr['cntlist'] = $country->getCountryCodes();
             if (isset($editArr['COUNTRY'])) {
                 $form_creator->popArr['provlist'] = $province->getProvinceCodes($editArr['COUNTRY']);
             }
             if (isset($editArr['STATE'])) {
                 $form_creator->popArr['districtlist'] = $district->getDistrictCodes($editArr['STATE']);
             }
             //Finding the numer of  employees
             $empInfo = new EmpInfo();
             $form_creator->popArr['empcount'] = $empInfo->countEmployee();
             break;
         case 'CUS':
             $form_creator->formPath = '/templates/eimadmin/customer.php';
             $customer = new Customer();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $customer->fetchCustomer($getArr['id']);
             } else {
                 $form_creator->popArr['editArr'] = new Customer();
             }
             break;
         case 'CTM':
             $form_creator->formPath = '/templates/eimadmin/customFields.php';
             $form_creator->popArr['available'] = CustomFields::getAvailableFieldNumbers();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = CustomFields::getCustomField($getArr['id']);
             } else {
                 $form_creator->popArr['editArr'] = new CustomFields();
             }
             break;
         case 'CEX':
             $form_creator->formPath = '/templates/eimadmin/customExportDefine.php';
             $form_creator->popArr['customExportList'] = CustomExport::getCustomExportList();
             if ($getArr['capturemode'] == 'updatemode') {
                 $customExport = CustomExport::getCustomExport($getArr['id']);
                 $form_creator->popArr['headings'] = $customExport->getHeadings();
                 $form_creator->popArr['available'] = $customExport->getAvailableFields();
                 $form_creator->popArr['assigned'] = $customExport->getAssignedFields();
                 $form_creator->popArr['exportName'] = $customExport->getName();
                 $form_creator->popArr['id'] = $customExport->getId();
             } else {
                 $form_creator->popArr['headings'] = array();
                 $form_creator->popArr['available'] = CustomExport::getAllFields();
                 $form_creator->popArr['assigned'] = array();
                 $form_creator->popArr['exportName'] = null;
                 $form_creator->popArr['id'] = null;
             }
             break;
         case 'CIM':
             $form_creator->formPath = '/templates/eimadmin/customImportDefine.php';
             $form_creator->popArr['customImportList'] = CustomImport::getCustomImportList();
             if ($getArr['capturemode'] == 'updatemode') {
                 $customImport = CustomImport::getCustomImport($getArr['id']);
                 $form_creator->popArr['has_heading'] = $customImport->getContainsHeader();
                 $form_creator->popArr['available'] = $customImport->getAvailableFields();
                 $form_creator->popArr['assigned'] = $customImport->getAssignedFields();
                 $form_creator->popArr['importName'] = $customImport->getName();
                 $form_creator->popArr['id'] = $customImport->getId();
                 $form_creator->popArr['compulsary_fields'] = CustomImport::getCompulsaryFields();
             } else {
                 $customImport = new CustomImport();
                 // Assign compulsary fields
                 $compulsary = CustomImport::getCompulsaryFields();
                 $customImport->setAssignedFields($compulsary);
                 $form_creator->popArr['has_heading'] = true;
                 $form_creator->popArr['available'] = $customImport->getAvailableFields();
                 $form_creator->popArr['assigned'] = $compulsary;
                 $form_creator->popArr['importName'] = null;
                 $form_creator->popArr['id'] = null;
                 $form_creator->popArr['compulsary_fields'] = $compulsary;
             }
             break;
         case 'CHD':
             $form_creator->formPath = '/templates/eimadmin/customExportHeadingDefine.php';
             $customExport = CustomExport::getCustomExport($getArr['id']);
             $headings = $customExport->getHeadings();
             $form_creator->popArr['headings'] = empty($headings) ? $customExport->getAssignedFields() : $headings;
             $form_creator->popArr['assigned'] = $customExport->getAssignedFields();
             $form_creator->popArr['exportName'] = $customExport->getName();
             $form_creator->popArr['id'] = $customExport->getId();
             break;
         case 'PAD':
             // Project Admin. Fall through to PRJ case below.
             $form_creator->getArr['uniqcode'] = "PRJ";
         case 'PRJ':
             $form_creator->formPath = '/templates/eimadmin/project.php';
             $project = new Projects();
             $customer = new Customer();
             $form_creator->popArr['cusid'] = $customer->fetchCustomers();
             $form_creator->popArr['employeeList'] = EmpInfo::getEmployeeMainDetails();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $project->fetchProject($getArr['id']);
                 $gw = new ProjectAdminGateway();
                 $form_creator->popArr['admins'] = $gw->getAdmins($getArr['id']);
             }
             break;
         case 'PAC':
             $form_creator->formPath = '/templates/eimadmin/projectActivity.php';
             /* If a HR admin, show all projects. Otherwise only show projects for which
              * user is an admin
              */
             $authorizeObj = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
             if ($authorizeObj->isAdmin()) {
                 $projects = new Projects();
                 /* Filter only not deleted projects */
                 $projects->setDeleted(Projects::PROJECT_NOT_DELETED);
                 $projectList = $projects->fetchProjects();
             } else {
                 if ($authorizeObj->isProjectAdmin()) {
                     $gw = new ProjectAdminGateway();
                     $projectList = $gw->getProjectsForAdmin($_SESSION['empID']);
                 }
             }
             /* If projectId given, get activities for that project else load first
              * project in list
              */
             $projectId = null;
             $activities = array();
             if (!empty($projectList)) {
                 if (isset($getArr['projectId']) && ($authorizeObj->isAdmin() || $authorizeObj->isProjectAdminOf($getArr['projectId']))) {
                     $projectId = $getArr['projectId'];
                 } else {
                     $projectId = $projectList[0]->getProjectId();
                 }
                 $activities = ProjectActivity::getActivityList($projectId);
             }
             $form_creator->popArr['projects'] = $projectList;
             $form_creator->popArr['projectId'] = $projectId;
             $form_creator->popArr['activities'] = $activities;
             break;
         case 'USR':
             $form_creator->formPath = '/templates/maintenance/users.php';
             $user = new Users();
             if ($getArr['capturemode'] == 'addmode') {
                 $form_creator->popArr['emplist'] = $user->getEmployeeCodes();
                 $form_creator->popArr['uglist'] = $user->getUserGroupCodes();
             } elseif ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $user->filterUsers($getArr['id']);
                 $form_creator->popArr['emplist'] = $user->getEmployeeCodes();
                 $form_creator->popArr['uglist'] = $user->getUserGroupCodes();
                 //$form_creator ->popArr['editArr'] = $user->filterChangeUsers($getArr['id']);
             }
             $form_creator->popArr['employeeSearchList'] = EmpInfo::getEmployeeSearchList();
             break;
         case 'USG':
             $form_creator->formPath = '/templates/maintenance/usergroups.php';
             $usrgrp = new UserGroups();
             if ($getArr['capturemode'] == 'updatemode') {
                 $form_creator->popArr['editArr'] = $usrgrp->filterUserGroups($getArr['id']);
             }
             break;
         case 'UGR':
             $form_creator->formPath = '/templates/maintenance/AdminMenu.php';
             $urights = new Rights();
             $usergroup = new UserGroups();
             $form_creator->popArr['ugDet'] = $usergroup->filterUserGroups($getArr['id']);
             $form_creator->popArr['modlist'] = $urights->getAllModules();
             if (isset($getArr['editID'])) {
                 $arr[0] = $getArr['id'];
                 $arr[1] = $getArr['editID'];
                 $form_creator->popArr['editArr'] = $urights->filterRights($arr);
             } else {
                 $form_creator->popArr['modlistUnAss'] = $urights->getModuleCodes($getArr['id']);
             }
             $form_creator->popArr['modlistAss'] = $urights->getAssRights($getArr['id']);
             break;
         case 'LDAP':
             if ($_SESSION['ldap'] == "enabled") {
                 $form_creator->formPath = '/templates/eimadmin/ldapConfiguration.php';
                 $ldapConfigObj = new LdapDetails();
                 $form_creator->popArr['editArr'] = $ldapConfigObj->retrieveLdapDetails();
             }
             break;
     }
     $form_creator->display();
 }
Example #3
0
 /**
  * Restores this module into the given course
  * @access  public
  * @param   int		$course_id	ID of the course to restore into
  * @param   string	$version	version number of the ATutor installation used to make this backup
  * @param   string	$import_dir	the path to the import directory
  * @author  Joel Kronenberg
  */
 function restore($course_id, $version, $import_dir)
 {
     static $CSVImport;
     if (!file_exists($this->_module_path . $this->_directoryName . '/module_backup.php')) {
         return;
     }
     if (!isset($CSVImport)) {
         require_once AT_INCLUDE_PATH . 'classes/CSVImport.class.php';
         $CSVImport = new CSVImport();
     }
     require $this->_module_path . $this->_directoryName . '/module_backup.php';
     if (isset($sql)) {
         foreach ($sql as $table_name => $table_sql) {
             $CSVImport->import($table_name, $import_dir, $course_id, $version);
         }
     }
     if ($this->_directoryName == '_core/content') {
         if (version_compare($version, '1.6.4', '<')) {
             $this->convertContent164($course_id);
         }
     }
     if (isset($dirs)) {
         foreach ($dirs as $src => $dest) {
             $dest = str_replace('?', $course_id, $dest);
             copys($import_dir . $src, $dest);
         }
     }
 }