示例#1
0
 private function administration()
 {
     /* Bail out if the user doesn't have SA permissions. */
     if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO && !$_SESSION['CATS']->hasUserCategory('careerportal')) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
     }
     $systemInfo = new SystemInfo();
     $systemInfoData = $systemInfo->getSystemInfo();
     if (isset($systemInfoData['available_version']) && $systemInfoData['available_version'] > CATSUtility::getVersionAsInteger()) {
         $newVersion = true;
     } else {
         $newVersion = false;
     }
     if (isset($systemInfoData['disable_version_check']) && $systemInfoData['disable_version_check']) {
         $versionCheckPref = false;
     } else {
         $versionCheckPref = true;
     }
     if ($this->_realAccessLevel >= ACCESS_LEVEL_ROOT || $this->_realAccessLevel == ACCESS_LEVEL_DEMO) {
         $systemAdministration = true;
     } else {
         $systemAdministration = false;
     }
     // FIXME: 's' isn't a good variable name.
     if (isset($_GET['s'])) {
         switch ($_GET['s']) {
             case 'siteName':
                 $templateFile = './modules/settings/SiteName.tpl';
                 break;
             case 'newVersionCheck':
                 if (!$systemAdministration) {
                     CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
                     return;
                     //$this->fatal(ERROR_NO_PERMISSION);
                 }
                 $this->_template->assign('versionCheckPref', $versionCheckPref);
                 $this->_template->assign('availableVersion', $systemInfoData['available_version']);
                 $this->_template->assign('newVersion', $newVersion);
                 $this->_template->assign('newVersionNews', NewVersionCheck::getNews());
                 $templateFile = './modules/settings/NewVersionCheck.tpl';
                 break;
             case 'passwords':
                 if (!$systemAdministration) {
                     CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
                     return;
                     //$this->fatal(ERROR_NO_PERMISSION);
                 }
                 $templateFile = './modules/settings/Passwords.tpl';
                 break;
             case 'localization':
                 if ($this->_realAccessLevel < ACCESS_LEVEL_SA) {
                     CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
                     return;
                     //$this->fatal(ERROR_NO_PERMISSION);
                 }
                 $this->_template->assign('timeZone', $_SESSION['CATS']->getTimeZone());
                 $this->_template->assign('isDateDMY', $_SESSION['CATS']->isDateDMY());
                 $templateFile = './modules/settings/Localization.tpl';
                 break;
             case 'systemInformation':
                 if ($this->_realAccessLevel < ACCESS_LEVEL_SA) {
                     CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
                     return;
                     //$this->fatal(ERROR_NO_PERMISSION);
                 }
                 $db = DatabaseConnection::getInstance();
                 $databaseVersion = $db->getRDBMSVersion();
                 $installationDirectory = realpath('./');
                 if (SystemUtility::isWindows()) {
                     $OSType = 'Windows';
                 } else {
                     if (SystemUtility::isMacOSX()) {
                         $OSType = 'Mac OS X';
                     } else {
                         $OSType = 'UNIX';
                     }
                 }
                 $schemaVersions = ModuleUtility::getModuleSchemaVersions();
                 $this->_template->assign('databaseVersion', $databaseVersion);
                 $this->_template->assign('installationDirectory', $installationDirectory);
                 $this->_template->assign('OSType', $OSType);
                 $this->_template->assign('schemaVersions', $schemaVersions);
                 $templateFile = './modules/settings/SystemInformation.tpl';
                 break;
             default:
                 $templateFile = './modules/settings/Administration.tpl';
                 break;
         }
     } else {
         $templateFile = './modules/settings/Administration.tpl';
         /* Load extra settings. */
         $extraSettings = array();
         $modules = ModuleUtility::getModules();
         foreach ($modules as $moduleName => $parameters) {
             $extraSettingsModule = $parameters[MODULE_SETTINGS_ENTRIES];
             if ($extraSettingsModule != false) {
                 foreach ($extraSettingsModule as $extraSettingsModuleData) {
                     if ($extraSettingsModuleData[2] <= $this->_realAccessLevel) {
                         $extraSettings[] = $extraSettingsModuleData;
                     }
                 }
             }
         }
         $this->_template->assign('extraSettings', $extraSettings);
     }
     if (!strcmp($templateFile, './modules/settings/Administration.tpl')) {
         // Highlight certain rows of importance based on criteria
         $candidates = new Candidates($this->_siteID);
         $this->_template->assign('totalCandidates', $candidates->getCount());
     }
     if (!eval(Hooks::get('SETTINGS_DISPLAY_ADMINISTRATION'))) {
         return;
     }
     /* Check if careers website is enabled or can be enabled */
     $careerPortalUnlock = false;
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $cpData = $careerPortalSettings->getAll();
     if (intval($cpData['enabled']) || file_exists('modules/asp') && !$_SESSION['CATS']->isFree() || LicenseUtility::isProfessional()) {
         $careerPortalUnlock = true;
     }
     $this->_template->assign('careerPortalUnlock', $careerPortalUnlock);
     $this->_template->assign('subActive', 'Administration');
     $this->_template->assign('systemAdministration', $systemAdministration);
     $this->_template->assign('active', $this);
     $this->_template->display($templateFile);
 }
示例#2
0
 private function listByView($errMessage = '')
 {
     // Log message that shows up on the top of the list page
     $topLog = '';
     $dataGridProperties = DataGrid::getRecentParamaters("candidates:candidatesListByViewDataGrid");
     /* If this is the first time we visited the datagrid this session, the recent paramaters will
      * be empty.  Fill in some default values. */
     if ($dataGridProperties == array()) {
         $dataGridProperties = array('rangeStart' => 0, 'maxResults' => 15, 'filterVisible' => false);
     }
     $dataGrid = DataGrid::get("candidates:candidatesListByViewDataGrid", $dataGridProperties);
     $candidates = new Candidates($this->_siteID);
     $this->_template->assign('totalCandidates', $candidates->getCount());
     $this->_template->assign('active', $this);
     $this->_template->assign('dataGrid', $dataGrid);
     $this->_template->assign('userID', $_SESSION['CATS']->getUserID());
     $this->_template->assign('errMessage', $errMessage);
     $this->_template->assign('topLog', $topLog);
     if (!eval(Hooks::get('CANDIDATE_LIST_BY_VIEW'))) {
         return;
     }
     $this->_template->display('./modules/candidates/Candidates.tpl');
 }