当前位置: 首页>>代码示例>>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;未经允许,请勿转载。