本文整理匯總了PHP中rating_manager::check_item_and_owner方法的典型用法代碼示例。如果您正苦於以下問題:PHP rating_manager::check_item_and_owner方法的具體用法?PHP rating_manager::check_item_and_owner怎麽用?PHP rating_manager::check_item_and_owner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rating_manager
的用法示例。
在下文中一共展示了rating_manager::check_item_and_owner方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
echo $OUTPUT->footer();
die;
}
$rm = new rating_manager();
//check the module rating permissions
//doing this check here rather than within rating_manager::get_ratings so we can return a json error response
$pluginrateallowed = true;
$pluginpermissionsarray = null;
if ($context->contextlevel == CONTEXT_MODULE) {
$plugintype = 'mod';
$pluginname = $cm->modname;
$pluginpermissionsarray = $rm->get_plugin_permissions_array($context->id, $plugintype, $pluginname);
$pluginrateallowed = $pluginpermissionsarray['rate'];
if ($pluginrateallowed) {
//check the item exists and isn't owned by the current user
$pluginrateallowed = $rm->check_item_and_owner($plugintype, $pluginname, $itemid);
}
}
if (!$pluginrateallowed || !has_capability('moodle/rating:rate', $context)) {
$result->error = get_string('ratepermissiondenied', 'rating');
echo json_encode($result);
die;
}
$PAGE->set_url('/lib/rate.php', array('contextid' => $context->id));
//rating options used to update the rating then retrieve the aggregate
$ratingoptions = new stdClass();
$ratingoptions->context = $context;
$ratingoptions->itemid = $itemid;
$ratingoptions->scaleid = $scaleid;
$ratingoptions->userid = $USER->id;
if ($userrating != RATING_UNSET_RATING) {