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


PHP rating_manager::get_user_grades方法代碼示例

本文整理匯總了PHP中rating_manager::get_user_grades方法的典型用法代碼示例。如果您正苦於以下問題:PHP rating_manager::get_user_grades方法的具體用法?PHP rating_manager::get_user_grades怎麽用?PHP rating_manager::get_user_grades使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rating_manager的用法示例。


在下文中一共展示了rating_manager::get_user_grades方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: forum_get_user_grades

/**
 * Return grade for given user or all users.
 *
 * @global object
 * @global object
 * @param object $forum
 * @param int $userid optional user id, 0 means all users
 * @return array array of grades, false if none
 */
function forum_get_user_grades($forum, $userid = 0) {
    global $CFG;

    require_once($CFG->dirroot.'/rating/lib.php');

    $ratingoptions = new stdClass;
    $ratingoptions->component = 'mod_forum';
    $ratingoptions->ratingarea = 'post';

    //need these to work backwards to get a context id. Is there a better way to get contextid from a module instance?
    $ratingoptions->modulename = 'forum';
    $ratingoptions->moduleid   = $forum->id;
    $ratingoptions->userid = $userid;
    $ratingoptions->aggregationmethod = $forum->assessed;
    $ratingoptions->scaleid = $forum->scale;
    $ratingoptions->itemtable = 'forum_posts';
    $ratingoptions->itemtableusercolumn = 'userid';

    $rm = new rating_manager();
    return $rm->get_user_grades($ratingoptions);
}
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:30,代碼來源:lib.php

示例2: glossary_get_user_grades

/**
 * Return grade for given user or all users.
 *
 * @global object
 * @param int $glossaryid id of glossary
 * @param int $userid optional user id, 0 means all users
 * @return array array of grades, false if none
 */
function glossary_get_user_grades($glossary, $userid = 0)
{
    /*global $DB;
    
        $params = array('userid'=>$userid, 'gid'=>$glossary->id);
    
        $user = $userid ? "AND u.id = :userid" : "";
    
        $sql = "SELECT u.id, u.id AS userid, avg(gr.rating) AS rawgrade
                  FROM {user} u, {glossary_entries} ge, {glossary_ratings} gr
                 WHERE u.id = ge.userid AND ge.id = gr.entryid
                       AND gr.userid != u.id AND ge.glossaryid = :gid
                       $user
              GROUP BY u.id";
    
        return $DB->get_records_sql($sql, $params);*/
    global $CFG;
    require_once $CFG->dirroot . '/rating/lib.php';
    $rm = new rating_manager();
    $ratingoptions = new stdclass();
    //need these to work backwards to get a context id. Is there a better way to get contextid from a module instance?
    $ratingoptions->modulename = 'glossary';
    $ratingoptions->moduleid = $glossary->id;
    $ratingoptions->userid = $userid;
    $ratingoptions->aggregationmethod = $glossary->assessed;
    $ratingoptions->scaleid = $glossary->scale;
    $ratingoptions->itemtable = 'glossary_entries';
    $ratingoptions->itemtableusercolumn = 'userid';
    return $rm->get_user_grades($ratingoptions);
}
開發者ID:vuchannguyen,項目名稱:web,代碼行數:38,代碼來源:lib.php

示例3: data_get_user_grades

/**
 * Return grade for given user or all users.
 *
 * @global object
 * @param object $data
 * @param int $userid optional user id, 0 means all users
 * @return array array of grades, false if none
 */
function data_get_user_grades($data, $userid=0) {
    global $CFG;

    require_once($CFG->dirroot.'/rating/lib.php');

    $ratingoptions = new stdClass;
    $ratingoptions->component = 'mod_data';
    $ratingoptions->ratingarea = 'entry';
    $ratingoptions->modulename = 'data';
    $ratingoptions->moduleid   = $data->id;

    $ratingoptions->userid = $userid;
    $ratingoptions->aggregationmethod = $data->assessed;
    $ratingoptions->scaleid = $data->scale;
    $ratingoptions->itemtable = 'data_records';
    $ratingoptions->itemtableusercolumn = 'userid';

    $rm = new rating_manager();
    return $rm->get_user_grades($ratingoptions);
}
開發者ID:nottmoo,項目名稱:moodle,代碼行數:28,代碼來源:lib.php

示例4: glossary_get_user_grades

/**
 * Return grade for given user or all users.
 *
 * @global object
 * @param int $glossaryid id of glossary
 * @param int $userid optional user id, 0 means all users
 * @return array array of grades, false if none
 */
function glossary_get_user_grades($glossary, $userid = 0)
{
    global $CFG;
    require_once $CFG->dirroot . '/rating/lib.php';
    $rm = new rating_manager();
    $ratingoptions = new stdclass();
    //need these to work backwards to get a context id. Is there a better way to get contextid from a module instance?
    $ratingoptions->modulename = 'glossary';
    $ratingoptions->moduleid = $glossary->id;
    $ratingoptions->userid = $userid;
    $ratingoptions->aggregationmethod = $glossary->assessed;
    $ratingoptions->scaleid = $glossary->scale;
    $ratingoptions->itemtable = 'glossary_entries';
    $ratingoptions->itemtableusercolumn = 'userid';
    return $rm->get_user_grades($ratingoptions);
}
開發者ID:esyacelga,項目名稱:sisadmaca,代碼行數:24,代碼來源:lib.php


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