本文整理匯總了PHP中cm_info::set_user_visible方法的典型用法代碼示例。如果您正苦於以下問題:PHP cm_info::set_user_visible方法的具體用法?PHP cm_info::set_user_visible怎麽用?PHP cm_info::set_user_visible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cm_info
的用法示例。
在下文中一共展示了cm_info::set_user_visible方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}
示例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);
}
}
示例3: 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);
}
}