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


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怎麽用?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) {
開發者ID:vuchannguyen,項目名稱:web,代碼行數:31,代碼來源:rate_ajax.php


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