/** * Loads a module. * * @param string module name * @return void */ public static function loadModule($moduleName) { $modules = self::getModules(); if (!isset($modules[$moduleName])) { if (class_exists('CommonErrors')) { CommonErrors::fatal(COMMONERROR_INVALIDMODULE, NULL, $moduleName); } else { echo 'Invalid module name \'' . htmlspecialchars($moduleName) . '\'.<br />Is the module installed?!'; die; } } $moduleClass = $modules[$moduleName][0]; if ($_SESSION["CATS"]->getSiteID() > 0) { $objPRGManagement = PRGManagement::getInstance(); $permit = $objPRGManagement->isModuleActionPermitted(); if ($permit === false) { header("Location:index.php"); exit; } } include_once 'modules/' . $moduleName . '/' . $moduleClass . '.php'; if (!eval(Hooks::get('LOAD_MODULE'))) { return; } $objModuleController = new $moduleClass(); $actionExist = false; $ret = null; //$moduleModelClass="Cls".ucfirst($moduleName)."Model"; //$moduleViewClass="Cls".ucfirst($moduleName)."View"; $moduleActionModelClass = ""; $moduleActionViewClass = ""; if (isset($_REQUEST['a']) && !empty($_REQUEST['a'])) { $action = $_REQUEST['a']; } else { if (isset($_REQUEST['p']) && $_REQUEST['p'] != "onApplyToJobOrder") { $action = $_REQUEST['p']; } else { $action = "listing"; } } $moduleActionViewClass = "Cls" . ucfirst($moduleName) . ucfirst($action) . "View"; $moduleActionModelClass = "Cls" . ucfirst($moduleName) . ucfirst($action) . "Model"; $actionMethod = $action; if (isset($_POST['postback']) || isset($_GET['getback'])) { $actionMethod = "on" . ucfirst($action); } /** * set model object if exist */ if (!class_exists($moduleActionModelClass) && file_exists("modules/{$moduleName}/{$moduleActionModelClass}.php")) { include_once "modules/{$moduleName}/{$moduleActionModelClass}.php"; } $objModel = null; if (class_exists($moduleActionModelClass)) { $objModel = new $moduleActionModelClass(); } /** * set view object if exist */ if (!class_exists($moduleActionViewClass) && file_exists("modules/{$moduleName}/{$moduleActionViewClass}.php")) { include_once "modules/{$moduleName}/{$moduleActionViewClass}.php"; } $objView = null; if (class_exists($moduleActionViewClass)) { if (is_null($objModel)) { $objView = new $moduleActionViewClass(); } else { $objView = new $moduleActionViewClass($objModel); } if (method_exists($objModuleController, "setView")) { $objModuleController->setView($objView); } } if (defined("AUIEO_API")) { include_once "lib/api.php"; $api = new API(); $suceess = $api->processApi(); /** * if request is proper process the request */ if ($suceess) { $webserviceMethod = "webservice" . ucfirst($action); if (method_exists($objModuleController, $webserviceMethod)) { $ret = $objModuleController->{$webserviceMethod}($api); exit; } } else { exit; } } else { if (method_exists($objModuleController, $actionMethod)) { $ret = $objModuleController->{$actionMethod}(); } else { if (method_exists($objModuleController, $action)) { $ret = $objModuleController->{$action}(); } else { if (method_exists($objModuleController, "render")) { $ret = $objModuleController->render(); } else { $ret = $objModuleController->handleRequest(); } } } } /** * if it is werservice and if the method exist, the control should not come here. * Since it came, it means the webservice method not exist */ if (defined("AUIEO_API")) { $api->response('', 404); exit; } $objTemplate = $objModuleController->getTemplateObject(); if (!$objTemplate->isRendered()) { if (isset($_REQUEST["file"])) { include_once "./modules/{$moduleName}/{$_REQUEST["file"]}.php"; } if (isset($objTemplate->errMessage) && $objTemplate->errMessage && file_exists("./modules/{$moduleName}/ErrorMessage.php")) { $tplfile = "./modules/{$moduleName}/ErrorMessage.php"; } else { if ($action == "listing") { if (!isset($objTemplate->totalRecords) || $objTemplate->totalRecords > 0 || !file_exists("./modules/{$moduleName}/{$action}.php")) { $tplfile = "./modules/{$moduleName}/{$action}.php"; } else { $tplfile = "./modules/{$moduleName}/NoRecord.php"; } } else { $tplfile = "./modules/{$moduleName}/{$action}.php"; } } if ($objModuleController->isViewSet()) { $objTemplate->display($tplfile, $objModuleController->getView()); } else { $objTemplate->display($tplfile); } } }
private function loadTheme($_AUIEO_ARR_THEME_VAR) { if($_SERVER["REQUEST_URI"]=="/demo/careers/") { $AUIEO_THEME_MODULE="careers"; } else if(isset($_REQUEST["m"]) && $_REQUEST["m"]=="careers") { $AUIEO_THEME_MODULE="careers"; } else if(!$_SESSION['CATS']->isLoggedIn()) { $AUIEO_THEME_MODULE="login"; } else { $AUIEO_THEME_MODULE=isset($_REQUEST["m"])?$_REQUEST["m"]:"index"; } $objModule=new ClsAuieoModule($AUIEO_THEME_MODULE,isset($_REQUEST["a"])?$_REQUEST["a"]:"create"); $actionTheme=$objModule->getConfigVar("actions"); if($actionTheme) { $AUIEO_THEME_MODULE=$actionTheme; } if(!file_exists("themes/default/{$AUIEO_THEME_MODULE}.php")) { $AUIEO_THEME_MODULE="index"; } extract($_AUIEO_ARR_THEME_VAR); unset($_AUIEO_ARR_THEME_VAR); $HTML_ENCODING=HTML_ENCODING; $AUIEO_USER_NAME = $_SESSION['CATS']->getUsername(); $AUIEO_SITE_NAME = $_SESSION['CATS']->getSiteName(); $AUIEO_FULL_NAME = $_SESSION['CATS']->getFullName(); $AUIEO_INDEX_NAME = CATSUtility::getIndexName(); $_AUIEO_MODULE=isset($_GET["m"])?$_GET["m"]:"home"; if (strpos($AUIEO_USER_NAME, '@'.$_SESSION['CATS']->getSiteID()) !== false && substr($AUIEO_USER_NAME, strpos($username, '@'.$_SESSION['CATS']->getSiteID())) == '@'.$_SESSION['CATS']->getSiteID() ) { $AUIEO_USER_NAME = str_replace('@'.$_SESSION['CATS']->getSiteID(), '', $AUIEO_USER_NAME); } $ACCESS_LEVEL_SA_GREATER=""; if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { $ACCESS_LEVEL_SA_GREATER = " <span style='font-weight:bold;'>Administrator</span>\n"; } $AUIEO_NOTICE=""; /* Disabled notice */ if (!$_SESSION['CATS']->accountActive()) { $AUIEO_NOTICE = "<span style='font-weight:bold;'>Account Inactive</span><br />\n"; } else if ($_SESSION['CATS']->getAccessLevel() == ACCESS_LEVEL_READ) { $AUIEO_NOTICE = "<span>Read Only Access</span><br />\n"; } ob_start(); $forceHighlight = ''; $modules = ModuleUtility::getModules(); if($_SESSION["CATS"]->getSiteID()>0) { $objPRGManagement=PRGManagement::getInstance(); } foreach ($modules as $moduleName => $parameters) { if($_SESSION["CATS"]->getSiteID()>0) { $permit=$objPRGManagement->isModulePermitted($moduleName); if($permit===false) { continue; } } $tabText = $parameters[1]; /* Don't display a module's tab if $tabText is empty. */ if (empty($tabText)) { continue; } /* If name = Companies and HR mode is on, change tab name to My Company. */ if ($_SESSION['CATS']->isHrMode() && $tabText == 'Companies') { $tabText = 'My Company'; } /* Allow a hook to prevent a module from being displayed. */ $displayTab = true; if (!eval(Hooks::get('TEMPLATE_UTILITY_EVALUATE_TAB_VISIBLE'))) return; if (!$displayTab) { continue; } /* Inactive Tab? */ if (!isset($this->active) || empty($this->active) || $moduleName != $this->active->getModuleName()) { if ($moduleName == $forceHighlight) { $className = 'active'; } else { $className = 'inactive'; } $alPosition = strpos($tabText, "*al="); if ($alPosition === false) { echo '<li><a class="', $className, '" href="', $AUIEO_INDEX_NAME, '?m=', $moduleName, '">', $tabText, '</a></li>', "\n"; } else { $al = substr($tabText, $alPosition + 4); if ($_SESSION['CATS']->getAccessLevel() >= $al || $_SESSION['CATS']->isDemo()) { echo '<li><a class="', $className, '" href="', $indexName, '?m=', $moduleName, '">', substr($tabText, 0, $alPosition), '</a></li>', "\n"; } } continue; } $alPosition = strpos($tabText, "*al="); if ($alPosition !== false) { $tabText = substr($tabText, 0, $alPosition); } /* Start the <li> block for the active tab. The secondary <ul> * for subtabs MUST be contained within this block. It is * closed after subtabs are printed. */ echo '<li>'; echo '<a class="active" href="', $AUIEO_INDEX_NAME, '?m=', $moduleName, '">', $tabText, '</a>', "\n"; $subTabs = $this->active->getSubTabs($modules); if ($subTabs) { echo '<ul id="secondary">'; foreach ($subTabs as $subTabText => $link) { if (isset($this->subActive) && $subTabText == $this->subActive) { $style = "color:#cccccc;"; } else { $style = ""; } /* Check HR mode for displaying tab. */ $hrmodePosition = strpos($link, "*hrmode="); if ($hrmodePosition !== false) { /* Access level restricted subtab. */ $hrmode = substr($link, $hrmodePosition + 8); if ((!$_SESSION['CATS']->isHrMode() && $hrmode == 0) || ($_SESSION['CATS']->isHrMode() && $hrmode == 1)) { $link = substr($link, 0, $hrmodePosition); } else { $link = ''; } } /* Check access level for displaying tab. */ $alPosition = strpos($link, "*al="); if ($alPosition !== false) { /* Access level restricted subtab. */ $al = substr($link, $alPosition + 4); if ($_SESSION['CATS']->getAccessLevel() >= $al || $_SESSION['CATS']->isDemo()) { $link = substr($link, 0, $alPosition); } else { $link = ''; } } $jsPosition = strpos($link, "*js="); if ($jsPosition !== false) { /* Javascript subtab. */ echo '<li><a href="', substr($link, 0, $jsPosition), '" onclick="', substr($link, $jsPosition + 4), '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } /* A few subtabs have special logic to decide if they display or not. */ /* FIXME: Put the logic for these somewhere else. Perhaps the definitions of the subtabs themselves should have an eval()uatable rule? Brian 6-14-07: Second. */ else if (strpos($link, 'a=internalPostings') !== false) { /* Default company subtab. */ include_once('./lib/Companies.php'); $companies = new Companies($_SESSION['CATS']->getSiteID()); $defaultCompanyID = $companies->getDefaultCompany(); if ($defaultCompanyID !== false) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } else if (strpos($link, 'a=administration') !== false) { /* Administration subtab. */ if ($_SESSION['CATS']->getRealAccessLevel() >= ACCESS_LEVEL_DEMO) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } else if (strpos($link, 'a=customizeEEOReport') !== false) { /* EEO Report subtab. Shouldn't be visible if EEO tracking is disabled. */ $EEOSettings = new EEOSettings($_SESSION['CATS']->getSiteID()); $EEOSettingsRS = $EEOSettings->getAll(); if ($EEOSettingsRS['enabled'] == 1) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } /* Tab is ok to draw. */ else if ($link != '') { /* Normal subtab. */ echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } if (!eval(Hooks::get('TEMPLATE_UTILITY_DRAW_SUBTABS'))) return; echo '</ul>'; } echo '</li>'; } $_AUIEO_TABS= ob_get_clean(); $systemInfo = new SystemInfo(); $systemInfoData = $systemInfo->getSystemInfo(); $AUIEO_DOWNLOAD_LATEST=""; if (isset($systemInfoData['available_version']) && $systemInfoData['available_version'] > CATSUtility::getVersionAsInteger() && isset($systemInfoData['disable_version_check']) && !$systemInfoData['disable_version_check'] && $_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { $AUIEO_DOWNLOAD_LATEST = "<a href='http://www.catsone.com/download.php' target='catsdl'>A new CATS version is available!</a><br />"; } $AUIEO_RECENT=""; if (!empty($MRU)) { $AUIEO_RECENT = '<span class="MRUTitle">Recent: </span> {$MRU}'; } else { $AUIEO_RECENT = '<span class="MRUTitle"></span> '; } $AUIEO_HAS_USER_CATEGORY=""; //FIXME: Abstract into a hook. if ($_SESSION['CATS']->hasUserCategory('msa')) { $AUIEO_HAS_USER_CATEGORY = "<input type='hidden' name='m' value='asp' /> <input type='hidden' name='a' value='aspSearch' /> <span class='quickSearchLabel' id='quickSearchLabel>ASP Search:</span> "; } else { $AUIEO_HAS_USER_CATEGORY = "<input type='hidden' name='m' value='home' /> <input type='hidden' name='a' value='quickSearch' /> <span class='quickSearchLabel' id='quickSearchLabel'>Quick Search:</span> "; } $wildCardString = ''; /* Get the formatted MRU list from Session. */ $MRU = $_SESSION['CATS']->getMRU()->getFormatted(); $indexName = CATSUtility::getIndexName(); $AUIEO_PREFIX=""; if(isset($_REQUEST["m"]) && $_REQUEST["m"]=="careers") { $AUIEO_PREFIX="../"; } $pageTitle = pageTitle(); $headIncludes = pageHeaderInclude(); $AUIEO_PAGE_START=""; ob_start(); //TemplateUtility::_printCommonHeader($pageTitle, $headIncludes); if (!is_array($headIncludes)) { $headIncludes = array($headIncludes); } $siteID = $_SESSION['CATS']->getSiteID(); /* This prevents caching problems when SVN updates are preformed. */ if ($_SESSION['CATS']->getCachedBuild() > 0) { $javascriptAntiCache = '?b=' . $_SESSION['CATS']->getCachedBuild(); } else { $javascriptAntiCache = '?v=' . CATSUtility::getVersionAsInteger(); } $headIncludes[] = 'main.css'; foreach ($headIncludes as $key => $filename) { /* Done manually to prevent a global dependency on FileUtility. */ if ($filename == 'tinymce') { echo ('<script language="javascript" type="text/javascript" src="lib/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>'."\n". '<script language="javascript" type="text/javascript">tinyMCE.init({ mode : "specific_textareas", editor_selector : "mceEditor", width : "100%", theme : "advanced", theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,separator,underline,forecolor,separator,removeformat,cleanup,separator,charmap,separator,undo,redo", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", language : "en", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_resizing : true, browsers : "msie,gecko,opera,safari", dialog_type : "modal", theme_advanced_resize_horizontal : false, convert_urls : false, relative_urls : false, remove_script_host : false, force_p_newlines : false, force_br_newlines : true, convert_newlines_to_brs : false, remove_linebreaks : false, fix_list_elements : true });</script>'."\n"); } else { $extension = substr($filename, strrpos($filename, '.') + 1); $filename .= $javascriptAntiCache; if ($extension == 'js') { echo '<script type="text/javascript" src="', $filename, '"></script>', "\n"; } else if ($extension == 'css') { echo '<style type="text/css" media="all">@import "', $filename, '";</style>', "\n"; } } } $AUIEO_PAGE_START= ob_get_clean(); //ob_start(); $AUIEO_LOAD_TIME = $_SESSION['CATS']->getExecutionTime(); $AUIEO_CANDIDATS_VERSION=CANDIDATS_VERSION; include("themes/default/{$AUIEO_THEME_MODULE}.php"); /** * for handing comment in html template. usage is {$_("This is comment")} */ $_=function($comment) { return ""; }; ob_start(); eval('echo <<< EOT '.file_get_contents("themes/default/{$AUIEO_THEME_MODULE}.html").' EOT; '); $html = ob_get_clean(); return $html; }