當前位置: 首頁>>代碼示例>>PHP>>正文


PHP cm_info::set_available方法代碼示例

本文整理匯總了PHP中cm_info::set_available方法的典型用法代碼示例。如果您正苦於以下問題:PHP cm_info::set_available方法的具體用法?PHP cm_info::set_available怎麽用?PHP cm_info::set_available使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cm_info的用法示例。


在下文中一共展示了cm_info::set_available方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: mod_forumng_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:nadavkav,項目名稱:Moodle2-Hebrew-plugins,代碼行數:11,代碼來源:lib.php

示例2: ouwiki_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:salmonmoose,項目名稱:moodle-mod_ouwiki,代碼行數:11,代碼來源:lib.php

示例3: ouwiki_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:ndunand,項目名稱:moodle-mod_ouwiki,代碼行數:11,代碼來源:lib.php

示例4: subpage_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:nadavkav,項目名稱:moodle-mod_subpage,代碼行數:11,代碼來源:lib.php

示例5: oublog_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:nadavkav,項目名稱:moodle-mod_oublog,代碼行數:16,代碼來源:lib.php

示例6: subpage_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:ninelanterns,項目名稱:moodle-mod_subpage,代碼行數:11,代碼來源:lib.php

示例7: oublog_cm_info_dynamic

/**
 * 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);
    }
}
開發者ID:eugeneventer,項目名稱:moodle-mod_oublog,代碼行數:22,代碼來源:lib.php


注:本文中的cm_info::set_available方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。