예제 #1
0
파일: index.php 프로젝트: rhertzog/lcs
// load Claroline kernel
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php';
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
// load libraries
FromKernel::uses('user.lib', 'utils/finder.lib');
require_once dirname(__FILE__) . '/lib/portlet.lib.php';
// Breadcrumb
FromKernel::uses('display/userprofilebox.lib');
ClaroBreadCrumbs::getInstance()->append(get_lang('My desktop'), get_path('clarolineRepositoryWeb') . 'desktop/index.php');
$dialogBox = new DialogBox();
define('KERNEL_PORTLETS_PATH', dirname(__FILE__) . '/lib/portlet');
// Load and register (if needed) portlets
try {
    $portletList = new PortletList();
    $fileFinder = new Claro_FileFinder_Extension(KERNEL_PORTLETS_PATH, '.class.php', false);
    foreach ($fileFinder as $file) {
        // Require portlet file
        require_once $file->getPathname();
        // Compute portlet class name from file name
        $pos = strpos($file->getFilename(), '.');
        $className = substr($file->getFilename(), '0', $pos);
        // Load portlet from database
        $portletInDB = $portletList->loadPortlet($className);
        // If it's not in DB, add it
        if (!$portletInDB) {
            if (class_exists($className)) {
                $portlet = new $className($portletInDB['label']);
                if ($portlet->getLabel()) {
                    $portletList->addPortlet($portlet->getLabel(), $portlet->getName());
예제 #2
0
파일: config.php 프로젝트: rhertzog/lcs
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
require_once dirname(__FILE__) . '/lib/portlet.lib.php';
FromKernel::uses('utils/input.lib', 'utils/validator.lib');
$dialogBox = new DialogBox();
// Get user input data
$userInput = Claro_UserInput::getInstance();
$acceptedCmdList = array('exDown', 'exUp', 'exVisible', 'exInvisible');
$userInput->setValidator('cmd', new Claro_Validator_AllowedList($acceptedCmdList));
$cmd = $userInput->get('cmd', null);
$label = $userInput->get('label', null);
// Execute commands
$portletList = new PortletList();
if ($cmd == 'exUp') {
    $portletList->moveUp($label);
}
if ($cmd == 'exDown') {
    $portletList->moveDown($label);
}
if ($cmd == 'exVisible') {
    $portletList->setVisible($label);
}
if ($cmd == 'exInvisible') {
    $portletList->setInvisible($label);
}
$portletList = $portletList->loadAll();
// Display
CssLoader::getInstance()->load('desktop', 'all');