示例#1
0
文件: index.php 项目: bqq1986/efront
if (isset($_SESSION['s_login']) && $_SESSION['s_login']) {
    //This way, logged in users that stay on index.php are not logged out
    $loadScripts[] = 'sidebar';
}
$smarty->assign("T_MESSAGE", $message);
$smarty->assign("T_MESSAGE_TYPE", $message_type);
if (isset($search_message)) {
    $smarty->assign("T_SEARCH_MESSAGE", $search_message);
}
if (!$smarty->is_cached('index.tpl', $cacheId) || !$GLOBALS['configuration']['smarty_caching']) {
    foreach (eF_loadAllModules(true, true) as $module) {
        $module->onIndexPageLoad();
    }
    $positions = $GLOBALS['currentTheme']->layout['positions'];
    //Main scripts, such as prototype
    $mainScripts = getMainScripts();
    $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
    //Operation/file specific scripts
    $loadScripts = array_diff($loadScripts, $mainScripts);
    //Clear out duplicates
    $smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts)));
    //array_unique, so it doesn't send duplicate entries
    if (in_array('news', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
        $smarty->assign("T_NEWS", news::getNews(0, true));
    }
    if (G_VERSIONTYPE == 'enterprise') {
        #cpp#ifdef ENTERPRISE
        require_once "../libraries/module_hcd_tools.php";
    }
    #cpp#endif
    if (EfrontUser::isOptionVisible('online_users') && in_array('online', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) {
 public function onPageFinishLoadingSmartyTpl()
 {
     if (!isset($_SESSION['lesson_rooms'])) {
         $_SESSION['lesson_rooms'] = array();
     }
     $smarty = $this->getSmartyVar();
     $mainScripts = array_merge(array('../modules/module_chat/js/chat'), getMainScripts());
     $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts));
     if ($this->isPopup()) {
         $smarty->assign("T_CHAT_MODULE_STATUS", "OFF");
     } else {
         $smarty->assign("T_CHAT_MODULE_STATUS", "ON");
     }
     if (!$_SESSION['chatter']) {
         $currentUser = $this->getCurrentUser();
         $_SESSION['chatter'] = $currentUser->login;
         $_SESSION['utype'] = $currentUser->getType();
         $this->calculateCommonality($currentUser->login);
         eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
     } else {
         $currentUser = $this->getCurrentUser();
         if ($_SESSION['chatter'] != $currentUser->login) {
             $_SESSION['chatter'] = $currentUser->login;
             $_SESSION['utype'] = $currentUser->getType();
             $this->calculateCommonality($currentUser->login);
             eF_executeNew("INSERT IGNORE INTO module_chat_users (username ,timestamp_) VALUES ('" . $_SESSION['chatter'] . "', CURRENT_TIMESTAMP);");
         }
     }
     $smarty->assign("T_CHAT_MODULE_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_CHAT_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_CHAT_MODULE_BASEDIR", $this->moduleBaseDir);
     $onlineUsers = EfrontUser::getUsersOnline();
     $smarty->assign("T_CHAT_MODULE_ONLINEUSERS", $onlineUsers);
     return $this->moduleBaseDir . "module_chat.tpl";
 }