本文整理汇总了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);
}
}