예제 #1
0
파일: welcome.php 프로젝트: kornelek/lms
 */
@(include LIB_DIR . '/locale/' . $_language . '/fortunes.php');
$layout['pagetitle'] = 'LAN Management System';
$layout['dbversion'] = $DB->GetDBVersion();
$layout['dbtype'] = ConfigHelper::getConfig('database.type');
if (ConfigHelper::checkConfig('privileges.superuser')) {
    $content = $LMS->CheckUpdates();
    if (isset($content['newer_version'])) {
        list($v, ) = preg_split('/\\s+/', $LMS->_version);
        if (version_compare($content['newer_version'], $v) > 0) {
            $SMARTY->assign('newer_version', $content['newer_version']);
        }
    }
    $SMARTY->assign('regdata', $LMS->GetRegisterData());
}
$SMARTY->assign('_dochref', is_dir('doc/html/' . $LMS->ui_lang) ? 'doc/html/' . $LMS->ui_lang . '/' : 'doc/html/en/');
$SMARTY->assign('rtstats', $LMS->RTStats());
if (ConfigHelper::checkConfig('privileges.superuser') || !ConfigHelper::checkConfig('privileges.hide_sysinfo')) {
    $SI = new Sysinfo();
    $SMARTY->assign('sysinfo', $SI->get_sysinfo());
}
if (ConfigHelper::checkConfig('privileges.superuser') || !ConfigHelper::checkConfig('privileges.hide_summaries')) {
    $SMARTY->assign('customerstats', $LMS->CustomerStats());
    $SMARTY->assign('nodestats', $LMS->NodeStats());
    if (file_exists(ConfigHelper::getConfig('directories.userpanel_dir') . DIRECTORY_SEPARATOR . 'index.php')) {
        $customerschanges = $DB->GetOne('SELECT COUNT(id) FROM up_info_changes');
        $SMARTY->assign('customerschanges', $customerschanges ? $customerschanges : 0);
    }
}
$layout['plugins'] = $plugin_manager->getAllPluginInfo();
$SMARTY->display('welcome/welcome.html');
예제 #2
0
function homepage_start()
{
    global $pageview, $SMARTY, $LMS, $DB, $CONFIG, $layout, $_language, $PROFILE, $AUTH, $SESSION, $voip, $registers;
    if (get_conf('homepage.box_customer') && !check_conf('privileges.hide_summaries')) {
        $pageview[] = 'box_customer';
    }
    if (get_conf('homepage.box_nodes') && !check_conf('privileges.hide_summaries')) {
        $pageview[] = 'box_nodes';
    }
    if (get_conf('homepage.box_helpdesk') && $LMS->RTStats()) {
        $pageview[] = 'box_helpdesk';
    }
    if (get_conf('homepage.box_callcenter')) {
        $pageview[] = 'box_callcenter';
    }
    if (get_conf('homepage.box_links') && !check_conf('privileges.hide_links')) {
        $pageview[] = 'box_links';
    }
    if (get_conf('homepage.box_board')) {
        $pageview[] = 'box_board';
    }
    if (get_conf('homepage.box_system') && !check_conf('privileges.hide_sysinfo')) {
        $pageview[] = 'box_system';
    }
    if (get_conf('homepage.box_lms') && !check_conf('privileges.hide_sysinfo')) {
        $pageview[] = 'box_lms';
    }
    if (get_conf('homepage.box_totd')) {
        $pageview[] = 'box_totd';
    }
    $obj = new xajaxResponse();
    if (check_conf('privileges.superuser') && !$registers) {
        $obj->assign("id_box_0a", "innerHTML", $SMARTY->fetch("welcome_box_registers.html"));
    }
    $count = sizeof($pageview);
    for ($i = 0; $i < $count; $i++) {
        if ($pageview[$i] == 'box_customer') {
            $customerstats = $LMS->CustomerStats();
            $SMARTY->assign('customerstats', $customerstats);
            $SMARTY->assign('contractending30', $LMS->getIdContractEnding('30'));
            $SMARTY->assign('contractending7', $LMS->getIdContractEnding('7'));
            $SMARTY->assign('contractnodata', $LMS->getIdContractEnding('-2'));
        } elseif ($pageview[$i] == 'box_nodes') {
            $SMARTY->assign('nodestats', $LMS->NodeStats());
        } elseif ($pageview[$i] == 'box_helpdesk') {
            $SMARTY->assign('rtstats', $LMS->RTStats());
        } elseif ($pageview[$i] == 'box_callcenter') {
            $result = $DB->GetRow('SELECT COUNT(id) AS total,
				COUNT(CASE WHEN closed = 1 THEN 1 END) AS zamkniete,
				COUNT(CASE WHEN closed = 0 THEN 1 END) AS otwarte
				FROM info_center WHERE deleted=0');
            $SMARTY->assign('callcenter_stats', $result);
        } elseif ($pageview[$i] == 'box_links') {
        } elseif ($pageview[$i] == 'box_board') {
            $userlist = $DB->GetAll('SELECT id, name FROM users WHERE deleted = ? ORDER BY name;', array(0));
            //$read = $PROFILE->get('board_status');
            if (!$SESSION->check_exists_key('board_status')) {
                $itemdata['board_status'] = 2;
                $SESSION->save('board_status', $itemdata['board_status']);
            } else {
                $itemdata['board_status'] = $SESSION->get('board_status');
            }
            if (!$SESSION->check_exists_key('board_prio')) {
                $itemdata['board_prio'] = '';
                $SESSION->save('board_prio', $itemdata['board_prio']);
            } else {
                $itemdata['board_prio'] = $SESSION->get('board_prio');
            }
            if (!$SESSION->check_exists_key('board_author')) {
                $itemdata['board_author'] = '';
                $SESSION->save('board_author', '');
            } else {
                $itemdata['board_author'] = $SESSION->get('board_author');
            }
            $SESSION->_saveSession();
            $SMARTY->assign('messlist', $messlist);
            $SMARTY->assign('itemdata', $itemdata);
            $SMARTY->assign('userlist', $userlist);
            $obj->script("xajax_board_view_list('-2','-2','-2');");
        } elseif ($pageview[$i] == 'box_lms') {
            $layout['dbversion'] = $DB->GetDBVersion();
            $layout['dbtype'] = $CONFIG['database']['type'];
        } elseif ($pageview[$i] == 'box_system') {
            require_once LIB_DIR . '/Sysinfo.class.php';
            $SI = new Sysinfo();
            $SMARTY->assign('sysinfo', $SI->get_sysinfo());
        } elseif ($pageview[$i] == 'box_totd') {
            @(include LIB_DIR . '/locale/' . $_language . '/fortunes.php');
        }
        $obj->assign("id_box_" . $i, "innerHTML", $SMARTY->fetch("welcome_" . $pageview[$i] . ".html"));
    }
    return $obj;
}