Exemplo n.º 1
0
/**
 * Sets the module uservisible to false if the user has not got the view capability
 * @param cm_info $cm
 */
function mod_forumng_cm_info_dynamic(cm_info $cm)
{
    if (!has_capability('mod/forumng:view', context_module::instance($cm->id))) {
        $cm->uservisible = false;
        $cm->set_available(false);
    }
}
Exemplo n.º 2
0
/**
 * Sets the module uservisible to false if the user has not got the view capability
 * @param cm_info $cm
 */
function ouwiki_cm_info_dynamic(cm_info $cm)
{
    if (!has_capability('mod/ouwiki:view', context_module::instance($cm->id))) {
        $cm->set_user_visible(false);
        $cm->set_available(false);
    }
}
Exemplo n.º 3
0
/**
 * Sets the module uservisible to false if the user has not got the view capability
 * @param cm_info $cm
 */
function ouwiki_cm_info_dynamic(cm_info $cm)
{
    if (!has_capability('mod/ouwiki:view', get_context_instance(CONTEXT_MODULE, $cm->id))) {
        $cm->uservisible = false;
        $cm->set_available(false);
    }
}
Exemplo n.º 4
0
/**
 * Sets the module uservisible to false if the user has not got the view
 * capability.
 * @param cm_info $cm Module data
 */
function subpage_cm_info_dynamic(cm_info $cm)
{
    if (!has_capability('mod/subpage:view', get_context_instance(CONTEXT_MODULE, $cm->id))) {
        $cm->set_available(false);
    }
}
Exemplo n.º 5
0
/**
 * Sets the module uservisible to false if the user has not got the view capability
 * @param cm_info $cm
 */
function oublog_cm_info_dynamic(cm_info $cm)
{
    $capability = 'mod/oublog:view';
    if ($cm->course == SITEID && $cm->instance == 1) {
        // Is global blog (To save DB call we make suspect assumption it is instance 1)?
        $capability = 'mod/oublog:viewpersonal';
    }
    if (!has_capability($capability, context_module::instance($cm->id))) {
        $cm->set_user_visible(false);
        $cm->set_available(false);
    }
}
Exemplo n.º 6
0
/**
 * Sets the module uservisible to false if the user has not got the view
 * capability.
 * @param cm_info $cm Module data
 */
function subpage_cm_info_dynamic(cm_info $cm)
{
    if (!has_capability('mod/subpage:view', context_module::instance($cm->id))) {
        $cm->set_available(false);
    }
}
Exemplo n.º 7
0
/**
 * Sets the module uservisible to false if the user has not got the view capability
 * @param cm_info $cm
 */
function oublog_cm_info_dynamic(cm_info $cm)
{
    global $remoteuserid, $USER;
    $userid = $USER;
    if (isset($remoteuserid) && !empty($remoteuserid)) {
        // Hack using dodgy global. The actual user id for specific user e.g. from webservice.
        $userid = $remoteuserid;
    }
    $capability = 'mod/oublog:view';
    if ($cm->course == SITEID && $cm->instance == 1) {
        // Is global blog (To save DB call we make suspect assumption it is instance 1)?
        $capability = 'mod/oublog:viewpersonal';
    }
    if (!has_capability($capability, context_module::instance($cm->id), $userid)) {
        $cm->set_user_visible(false);
        $cm->set_available(false);
    }
}