示例#1
0
文件: wiki.php 项目: rhertzog/lcs
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * CLAROLINE
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 *              This program is under the terms of the GENERAL PUBLIC LICENSE (GPL)
 *              as published by the FREE SOFTWARE FOUNDATION. The GPL is available
 *              through the world-wide-web at http://www.gnu.org/copyleft/gpl.html
 * @author      Frederic Minne <*****@*****.**>
 * @package     Wiki
 */
$tlabelReq = 'CLWIKI';
require_once "../inc/claro_init_global.inc.php";
if (!claro_is_tool_allowed()) {
    if (!claro_is_in_a_course()) {
        claro_disp_auth_form(true);
    } else {
        claro_die(get_lang("Not allowed"));
    }
}
// display mode
claro_set_display_mode_available(TRUE);
// check and set user access level for the tool
// set admin mode and groupId
$is_allowedToAdmin = claro_is_allowed_to_edit();
if (claro_is_in_a_group() && claro_is_group_allowed()) {
    // group context
    $groupId = (int) claro_get_current_group_id();
} elseif (claro_is_in_a_group() && !claro_is_group_allowed()) {
示例#2
0
文件: init.lib.php 项目: rhertzog/lcs
function claro_is_module_allowed()
{
    if (!array_key_exists('tlabelReq', $GLOBALS)) {
        return claro_failure::set_failure('MISSING TOOL LABEL');
    }
    $moduleLabel = $GLOBALS['tlabelReq'];
    $moduleData = get_module_data($moduleLabel);
    if ($moduleData['type'] == 'tool') {
        $contextList = get_module_context_list($moduleLabel);
        // pushClaroMessage(var_export(iterator_to_array($contextList), true),'kernel');
        if (!claro_is_in_a_course() && in_array('platform', iterator_to_array($contextList))) {
            return get_module_data($moduleLabel, 'activation') == 'activated';
        }
        // if a course tool, use claro_is_tool_allowed
        return claro_is_tool_allowed();
    } else {
        // if an applet "tool", return true if activated
        // and let module manage it's access by itself
        return $moduleData['activation'] == 'activated';
    }
}
示例#3
0
function printInit($selection = "*")
{
    global $uidReset, $cidReset, $gidReset, $tidReset, $uidReq, $cidReq, $gidReq, $tidReq, $tlabelReq, $_user, $_course, $_groupUser, $_courseTool, $_SESSION, $_claro_local_run;
    if ($_claro_local_run) {
        echo "local init runned";
    } else {
        echo '<font color="red"> local init never runned during this script </font>';
    }
    echo '
<table width="100%" border="1" cellspacing="4" cellpadding="1" bordercolor="#808080" bgcolor="#C0C0C0" lang="en">
    <TR>';
    if ($selection == "*" or strstr($selection, "u")) {
        echo '
        <TD valign="top" >
            <strong>User</strong> :
            (_uid)             : ' . var_export(claro_get_current_user_id(), 1) . ' |
            (session[_uid]) : ' . var_export($_SESSION["_uid"], 1) . '
            <br />
            reset = ' . var_export($uidReset, 1) . ' |
            req = ' . var_export($uidReq, 1) . '<br />
            _user : <pre>' . var_export($_user, 1) . '</pre>
            <br />is_platformAdmin            :' . var_export(claro_is_platform_admin(), 1) . '
            <br />is_allowedCreateCourse    :' . var_export(claro_is_allowed_to_create_course(), 1) . '
        </TD>';
    }
    if ($selection == "*" or strstr($selection, "c")) {
        echo "\n        <TD valign=\"top\" >\n            <strong>Course</strong> : (_cid)" . var_export(claro_get_current_course_id(), 1) . "\n            <br />\n            reset = " . var_export($cidReset, 1) . " | req = " . var_export($cidReq, 1) . "\n            <br />\n            _course : <pre>" . var_export($_course, 1) . "</pre>\n            <br />\n            _groupProperties :\n            <PRE>\n                " . var_export(claro_get_current_group_properties_data(), 1) . "\n            </PRE>\n        </TD>";
    }
    echo '
    </TR>
    <TR>';
    if ($selection == "*" or strstr($selection, "g")) {
        echo '<TD valign="top" ><strong>Group</strong> : (_gid) ' . var_export(claro_get_current_group_id(), 1) . '<br />
        reset = ' . var_export($GLOBALS['gidReset'], 1) . ' | req = ' . var_export($gidReq, 1) . "<br />\n        _group :<pre>" . var_export(claro_get_current_group_data(), 1) . "</pre></TD>";
    }
    if ($selection == "*" or strstr($selection, "t")) {
        echo '<TD valign="top" ><strong>Tool</strong> : (_tid)' . var_export(claro_get_current_tool_id(), 1) . '<br />
        reset = ' . var_export($tidReset, 1) . ' |
        req = ' . var_export($tidReq, 1) . '|
        req = ' . var_export($tlabelReq, 1) . '
        <br />
        _tool :' . var_export(get_init('_tool'), 1) . "</TD>";
    }
    echo "</TR>";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "c")) {
        echo '<TR><TD valign="top" colspan="2"><strong>Course-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . var_export(claro_get_current_course_id(), 1) . '<br />';
        }
        if (claro_is_user_authenticated() && claro_get_current_course_id()) {
            echo '_courseUser            : <pre>' . var_export(getInit('_courseUser'), 1) . '</pre>';
        }
        echo '<br />is_courseMember    : ' . var_export(claro_is_course_member(), 1);
        echo '<br />is_courseAdmin    : ' . var_export(claro_is_course_manager(), 1);
        echo '<br />is_courseAllowed    : ' . var_export(claro_is_course_allowed(), 1);
        echo '<br />is_courseTutor    : ' . var_export(claro_is_course_tutor(), 1);
        echo '</TD></TR>';
    }
    echo "";
    if ($selection == "*" or strstr($selection, "u") && strstr($selection, "g")) {
        echo '<TR><TD valign="top"  colspan="2">' . '<strong>Course-Group-User</strong>';
        if (claro_is_user_authenticated()) {
            echo '<br /><strong>User</strong> :' . var_export(claro_is_in_a_course(), 1);
        }
        if (claro_is_in_a_group()) {
            echo ' in ' . var_export(claro_get_current_group_id(), 1);
        }
        if (claro_is_in_a_group()) {
            echo '<br />_groupUser:'******'_groupUser'), 1);
        }
        echo '<br />is_groupMember:' . var_export(claro_is_group_member(), 1) . '<br />is_groupTutor: ' . var_export(claro_is_group_tutor(), 1) . '<br />is_groupAllowed:' . var_export(claro_is_group_allowed(), 1) . '</TD>' . '</tr>';
    }
    if ($selection == "*" or strstr($selection, "c") && strstr($selection, "t")) {
        echo '<tr>
        <TD valign="top" colspan="2" ><strong>Course-Tool</strong><br />';
        if (claro_get_current_tool_id()) {
            echo 'Tool :' . claro_get_current_tool_id();
        }
        if (claro_is_in_a_course()) {
            echo ' in ' . claro_get_current_course_id() . '<br />';
        }
        if (claro_get_current_tool_id()) {
            echo "_courseTool    : <pre>" . var_export($_courseTool, 1) . '</pre><br />';
        }
        echo 'is_toolAllowed : ' . var_export(claro_is_tool_allowed(), 1);
        echo "</TD>";
    }
    echo "</TR></TABLE>";
}