本文整理汇总了PHP中repository::check_capability方法的典型用法代码示例。如果您正苦于以下问题:PHP repository::check_capability方法的具体用法?PHP repository::check_capability怎么用?PHP repository::check_capability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repository
的用法示例。
在下文中一共展示了repository::check_capability方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die(json_encode($err));
}
if (!confirm_sesskey()) {
$err->error = get_string('invalidsesskey');
die(json_encode($err));
}
/// Get repository instance information
$sql = 'SELECT i.name, i.typeid, r.type FROM {repository} r, {repository_instances} i WHERE i.id=? AND i.typeid=r.id';
if (!($repository = $DB->get_record_sql($sql, array($repo_id)))) {
$err->error = get_string('invalidrepositoryid', 'repository');
die(json_encode($err));
} else {
$type = $repository->type;
}
/// Check permissions
repository::check_capability($contextid, $repository);
$moodle_maxbytes = get_max_upload_file_size();
// to prevent maxbytes greater than moodle maxbytes setting
if ($maxbytes == 0 || $maxbytes >= $moodle_maxbytes) {
$maxbytes = $moodle_maxbytes;
}
/// Wait as long as it takes for this script to finish
set_time_limit(0);
// Early actions which need to be done before repository instances initialised
switch ($action) {
// global search
case 'gsearch':
$params = array();
$params['context'] = array(get_context_instance_by_id($contextid), get_system_context());
$params['currentcontext'] = get_context_instance_by_id($contextid);
$repos = repository::get_instances($params);