• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP user_picture类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中user_picture的典型用法代码示例。如果您正苦于以下问题:PHP user_picture类的具体用法?PHP user_picture怎么用?PHP user_picture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了user_picture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_other_values

 protected function get_other_values(renderer_base $output)
 {
     global $PAGE, $CFG;
     // Add user picture.
     $userpicture = new \user_picture($this->data);
     $userpicture->size = 1;
     // Size f1.
     $profileimageurl = $userpicture->get_url($PAGE)->out(false);
     $userpicture->size = 0;
     // Size f2.
     $profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
     $profileurl = (new moodle_url('/user/profile.php', array('id' => $this->data->id)))->out(false);
     $identityfields = array_flip(explode(',', $CFG->showuseridentity));
     $data = $this->data;
     foreach ($identityfields as $field => $index) {
         if (!empty($data->{$field})) {
             $identityfields[$field] = $data->{$field};
         } else {
             unset($identityfields[$field]);
         }
     }
     $identity = implode(', ', $identityfields);
     return array('fullname' => fullname($this->data), 'profileimageurl' => $profileimageurl, 'profileimageurlsmall' => $profileimageurlsmall, 'profileurl' => $profileurl, 'identity' => $identity);
 }
开发者ID:reconnectmedia,项目名称:moodle,代码行数:24,代码来源:user_summary_exporter.php


示例2: block_ranking_get_students_by_date

/**
 * Get the students points based on a time interval
 *
 * @param int
 * @param int
 * @param int
 * @return mixed
 */
function block_ranking_get_students_by_date($limit = null, $datestart, $dateend)
{
    global $COURSE, $DB, $PAGE;
    // Get block ranking configuration.
    $cfgranking = get_config('block_ranking');
    // Get limit from default configuration or instance configuration.
    if (!$limit) {
        if (isset($cfgranking->rankingsize) && trim($cfgranking->rankingsize) != '') {
            $limit = $cfgranking->rankingsize;
        } else {
            $limit = 10;
        }
    }
    $context = $PAGE->context;
    $userfields = user_picture::fields('u', array('username'));
    $sql = "SELECT\n                DISTINCT {$userfields},\n                sum(rl.points) as points\n            FROM\n                {user} u\n            INNER JOIN {role_assignments} a ON a.userid = u.id\n            INNER JOIN {ranking_points} r ON r.userid = u.id AND r.courseid = :r_courseid\n            INNER JOIN {ranking_logs} rl ON rl.rankingid = r.id\n            INNER JOIN {context} c ON c.id = a.contextid\n            WHERE a.contextid = :contextid\n            AND a.userid = u.id\n            AND a.roleid = :roleid\n            AND c.instanceid = :courseid\n            AND r.courseid = :crsid\n            AND rl.timecreated BETWEEN :weekstart AND :weekend\n            GROUP BY u.id\n            ORDER BY points DESC, u.firstname ASC\n            LIMIT " . $limit;
    $params['contextid'] = $context->id;
    $params['roleid'] = 5;
    $params['courseid'] = $COURSE->id;
    $params['r_courseid'] = $COURSE->id;
    $params['crsid'] = $COURSE->id;
    $params['weekstart'] = $datestart;
    $params['weekend'] = $dateend;
    $users = array_values($DB->get_records_sql($sql, $params));
    return $users;
}
开发者ID:ramcoelho,项目名称:moodle-block_ranking,代码行数:34,代码来源:lib.php


示例3: test_update_user_profile_image

 /**
  * Test the update user profile image function.
  */
 public function test_update_user_profile_image()
 {
     global $DB, $CFG;
     // Set the profile image.
     \enrol_lti\helper::update_user_profile_image($this->user1->id, $this->getExternalTestFileUrl('/test.jpg'));
     // Get the new user record.
     $this->user1 = $DB->get_record('user', array('id' => $this->user1->id));
     // Set the page details.
     $page = new moodle_page();
     $page->set_url('/user/profile.php');
     $page->set_context(context_system::instance());
     $renderer = $page->get_renderer('core');
     $usercontext = context_user::instance($this->user1->id);
     // Get the user's profile picture and make sure it is correct.
     $userpicture = new user_picture($this->user1);
     $this->assertSame($CFG->wwwroot . '/pluginfile.php/' . $usercontext->id . '/user/icon/clean/f2?rev=' . $this->user1->picture, $userpicture->get_url($page, $renderer)->out(false));
 }
开发者ID:janeklb,项目名称:moodle,代码行数:20,代码来源:helper_test.php


示例4: get_user_picture

function get_user_picture($userid)
{
    global $DB;
    $extrafields[] = 'lastaccess';
    $ufields = user_picture::fields('u', $extrafields);
    $sql = "SELECT DISTINCT {$ufields} FROM {user} u where u.id={$userid}";
    $user = $DB->get_record_sql($sql);
    return new user_picture($user);
}
开发者ID:alendit,项目名称:moodle-enrol_apply,代码行数:9,代码来源:apply.php


示例5: scheduler_get_attendants

/**
 * get list of attendants for slot form
 * @param int $cmid the course module
 * @param mixed $groupid id number of the group to select from, 0 or '' if all groups
 * @return array of moodle user records
 */
function scheduler_get_attendants($cmid, $groupid = '')
{
    $context = context_module::instance($cmid);
    if (!$groupid) {
        $groupkeys = '';
    } else {
        $groupkeys = array($groupid);
    }
    $attendants = get_users_by_capability($context, 'mod/scheduler:attend', user_picture::fields('u'), 'u.lastname, u.firstname', '', '', $groupkeys, '', false, false, false);
    return $attendants;
}
开发者ID:ninelanterns,项目名称:moodle-mod_scheduler,代码行数:17,代码来源:locallib.php


示例6: get_content

 function get_content()
 {
     global $USER, $CFG, $DB, $OUTPUT;
     if (!$CFG->messaging) {
         $this->content = new stdClass();
         $this->content->text = '';
         $this->content->footer = '';
         if ($this->page->user_is_editing()) {
             $this->content->text = get_string('disabled', 'message');
         }
         return $this->content;
     }
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance) or !isloggedin() or isguestuser() or empty($CFG->messaging)) {
         return $this->content;
     }
     $link = '/message/index.php';
     $action = null;
     //this was using popup_action() but popping up a fullsize window seems wrong
     $this->content->footer = $OUTPUT->action_link($link, get_string('messages', 'message'), $action);
     $ufields = user_picture::fields('u', array('lastaccess'));
     $users = $DB->get_records_sql("SELECT {$ufields}, COUNT(m.useridfrom) AS count\n                                         FROM {user} u, {message} m\n                                        WHERE m.useridto = ? AND u.id = m.useridfrom AND m.notification = 0\n                                     GROUP BY {$ufields}", array($USER->id));
     //Now, we have in users, the list of users to show
     //Because they are online
     if (!empty($users)) {
         $this->content->text .= '<ul class="list">';
         foreach ($users as $user) {
             $timeago = format_time(time() - $user->lastaccess);
             $this->content->text .= '<li class="listentry"><div class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . SITEID . '" title="' . $timeago . '">';
             $this->content->text .= $OUTPUT->user_picture($user, array('courseid' => SITEID));
             //TODO: user might not have capability to view frontpage profile :-(
             $this->content->text .= fullname($user) . '</a></div>';
             $link = '/message/index.php?usergroup=unread&id=' . $user->id;
             $anchortagcontents = '<img class="iconsmall" src="' . $OUTPUT->pix_url('t/message') . '" alt="" />&nbsp;' . $user->count;
             $action = null;
             // popup is gone now
             $anchortag = $OUTPUT->action_link($link, $anchortagcontents, $action);
             $this->content->text .= '<div class="message">' . $anchortag . '</div></li>';
         }
         $this->content->text .= '</ul>';
     } else {
         $this->content->text .= '<div class="info">';
         $this->content->text .= get_string('nomessages', 'message');
         $this->content->text .= '</div>';
     }
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:52,代码来源:block_messages.php


示例7: definition

 public function definition()
 {
     global $USER, $OUTPUT, $CFG;
     $mform = $this->_form;
     $instance = $this->_customdata;
     $this->instance = $instance;
     $plugin = enrol_get_plugin('boleto');
     $heading = $plugin->get_instance_name($instance);
     $mform->addElement('header', 'boletoheader', $heading);
     if ($instance->password) {
         // Change the id of boleto enrolment key input as there can be multiple boleto enrolment methods.
         $mform->addElement('passwordunmask', 'enrolpassword', get_string('password', 'enrol_boleto'), array('id' => 'enrolpassword_' . $instance->id));
         $context = context_course::instance($this->instance->courseid);
         $keyholders = get_users_by_capability($context, 'enrol/boleto:holdkey', user_picture::fields('u'));
         $keyholdercount = 0;
         foreach ($keyholders as $keyholder) {
             $keyholdercount++;
             if ($keyholdercount === 1) {
                 $mform->addElement('static', 'keyholder', '', get_string('keyholder', 'enrol_boleto'));
             }
             $keyholdercontext = context_user::instance($keyholder->id);
             if ($USER->id == $keyholder->id || has_capability('moodle/user:viewdetails', context_system::instance()) || has_coursecontact_role($keyholder->id)) {
                 $profilelink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $keyholder->id . '&amp;course=' . $this->instance->courseid . '">' . fullname($keyholder) . '</a>';
             } else {
                 $profilelink = fullname($keyholder);
             }
             $profilepic = $OUTPUT->user_picture($keyholder, array('size' => 35, 'courseid' => $this->instance->courseid));
             $mform->addElement('static', 'keyholder' . $keyholdercount, '', $profilepic . $profilelink);
         }
     }
     $boletourl = new moodle_url('/enrol/boleto/boleto.php', array('instanceid' => $this->instance->id));
     $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfo', 'enrol_boleto'));
     // customint8 == avista.
     if ($this->instance->customint8) {
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfodirectlinks', 'enrol_boleto', $boletourl->out(false)));
     } else {
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink0', 'enrol_boleto', $boletourl->out(false)));
         $boletourl->param('parcela', 1);
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink1', 'enrol_boleto', $boletourl->out(false)));
         $boletourl->param('parcela', 2);
         $mform->addElement('static', 'info', '', get_string('boletoprintandpayinfoparceladolink2', 'enrol_boleto', $boletourl->out(false)));
     }
     $this->add_action_buttons(false, get_string('enrolme', 'enrol_boleto'));
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->setDefault('id', $instance->courseid);
     $mform->addElement('hidden', 'instance');
     $mform->setType('instance', PARAM_INT);
     $mform->setDefault('instance', $instance->id);
 }
开发者ID:josenorberto,项目名称:moodle-enrol_boleto,代码行数:50,代码来源:locallib.php


示例8: col_fullname

 /**
  * @param stdClass $data row data
  * @return string HTML for the fullname column
  */
 public function col_fullname($data)
 {
     if (is_null($data->realuserid)) {
         // User is in the git history but does not have an account in this Moodle site.
         $user = new stdClass();
         $user->firstname = $data->firstname;
         $user->lastname = $data->lastname;
         // Additional fields so fullname() doesn't display a developer debug message.
         $user->firstnamephonetic = null;
         $user->lastnamephonetic = null;
         $user->middlename = null;
         $user->alternatename = null;
     } else {
         $user = user_picture::unalias($data, null, "realuserid", "realuser");
     }
     return fullname($user);
 }
开发者ID:albertolarah,项目名称:moodle-local_dev,代码行数:21,代码来源:tablelib.php


示例9: getUserList

function getUserList($currentgroup = '', $courseId, $contextlevel, $context, $limitUsers = 15)
{
    global $USER, $CFG, $DB, $OUTPUT;
    $groupmembers = "";
    $groupselect = "";
    $params = array();
    //Add this to the SQL to show only group users
    if ($currentgroup !== NULL) {
        $groupmembers = ", {groups_members} gm";
        $groupselect = "AND u.id = gm.userid AND gm.groupid = :currentgroup";
        $params['currentgroup'] = $currentgroup;
    }
    $userfields = user_picture::fields('u', array('username'));
    if ($courseId == SITEID or $contextlevel < CONTEXT_COURSE) {
        // Site-level
        //Only show if is admin
        if (!checkIfUserIsAdmin()) {
            return '';
        }
        $sql = "SELECT {$userfields}, ul.lastip, MAX(ul.timemodified) AS lastaccess\n                      FROM {user} u {$groupmembers} ,{sessions} ul\n                     WHERE u.id = ul.userid AND u.deleted = 0\n                     {$groupselect}\n                  GROUP BY {$userfields}\n                  ORDER BY ul.timemodified DESC ";
    } else {
        // Course level - show only enrolled users for now
        //Only show if is teacher or admin
        if (!checkIfUserIsTeacher($courseId)) {
            return '';
        }
        list($esqljoin, $eparams) = get_enrolled_sql($context);
        $params = array_merge($params, $eparams);
        $sql = "SELECT {$userfields}, ul.lastip, MAX(ul.timemodified) AS lastaccess\n                      FROM {sessions} ul {$groupmembers}, {user} u\n                      JOIN ({$esqljoin}) euj ON euj.id = u.id\n                     WHERE u.id = ul.userid\n                           AND u.deleted = 0\n                           {$groupselect}\n                  GROUP BY {$userfields}\n                  ORDER BY lastaccess DESC";
        $params['courseid'] = $courseId;
    }
    if ($users = $DB->get_records_sql($sql, $params, 0, $limitUsers)) {
        // We'll just take the most recent 50 maximum
        foreach ($users as $user) {
            $users[$user->id]->fullname = fullname($user);
        }
    } else {
        $users = array();
    }
    return $users;
}
开发者ID:ed-rom,项目名称:moodle-block_uniqueloginlist,代码行数:41,代码来源:locallib.php


示例10: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     global $PAGE;
     parent::__construct($uniqueid);
     // Block XP stuff.
     $this->xpmanager = block_xp_manager::get($courseid);
     $this->xpoutput = $PAGE->get_renderer('block_xp');
     // Define columns.
     $this->define_columns(array('rank', 'userpic', 'fullname', 'lvl', 'xp', 'progress'));
     $this->define_headers(array(get_string('rank', 'block_xp'), '', get_string('fullname'), get_string('level', 'block_xp'), get_string('xp', 'block_xp'), get_string('progress', 'block_xp')));
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . user_picture::fields('u');
     $this->sql->from = '{block_xp} x LEFT JOIN {user} u ON x.userid = u.id';
     $this->sql->where = 'courseid = :courseid';
     $this->sql->params = array('courseid' => $courseid);
     // Define various table settings.
     $this->sortable(false);
     $this->no_sorting('userpic');
     $this->no_sorting('progress');
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:27,代码来源:ladder_table.php


示例11: get_authors

    protected function get_authors() {
        global $DB;
        $rslt = $this->workshop->get_submissions_grouped();
        //now we have to do some magic to turn these back into "authors"
        $ret = array();
        $users = array();
        
        //loop 1: get user ids
        foreach ($rslt as $r) {
            $users[] = $r->authorid;
        }
        $fields = user_picture::fields();
        $users = $DB->get_records_list('user','id',$users,'',$fields);
        //loop 2: apply users to submissions 
        $ret[0] = array();
        foreach ($rslt as $r){
            $ret[$r->group->id] = array( $r->authorid => $users[$r->authorid] );
            $ret[0][$r->authorid] = $users[$r->authorid];
        }

        return $ret;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:22,代码来源:teamlib.php


示例12: set_sql

 /**
  * Store the SQL queries & params for listing online users
  *
  * @param int $currentgroup The group (if any) to filter on
  * @param int $now Time now
  * @param int $timetoshowusers Number of seconds to show online users
  * @param context $context Context object used to generate the sql for users enrolled in a specific course
  * @param bool $sitelevel Whether to check online users at site level.
  * @param int $courseid The course id to check
  */
 protected function set_sql($currentgroup, $now, $timetoshowusers, $context, $sitelevel, $courseid)
 {
     $timefrom = 100 * floor(($now - $timetoshowusers) / 100);
     // Round to nearest 100 seconds for better query cache.
     $groupmembers = "";
     $groupselect = "";
     $groupby = "";
     $lastaccess = ", lastaccess";
     $timeaccess = ", ul.timeaccess AS lastaccess";
     $params = array();
     $userfields = \user_picture::fields('u', array('username'));
     // Add this to the SQL to show only group users.
     if ($currentgroup !== null) {
         $groupmembers = ", {groups_members} gm";
         $groupselect = "AND u.id = gm.userid AND gm.groupid = :currentgroup";
         $groupby = "GROUP BY {$userfields}";
         $lastaccess = ", MAX(u.lastaccess) AS lastaccess";
         $timeaccess = ", MAX(ul.timeaccess) AS lastaccess";
         $params['currentgroup'] = $currentgroup;
     }
     $params['now'] = $now;
     $params['timefrom'] = $timefrom;
     if ($sitelevel) {
         $sql = "SELECT {$userfields} {$lastaccess}\n                      FROM {user} u {$groupmembers}\n                     WHERE u.lastaccess > :timefrom\n                           AND u.lastaccess <= :now\n                           AND u.deleted = 0\n                           {$groupselect} {$groupby}\n                  ORDER BY lastaccess DESC ";
         $csql = "SELECT COUNT(u.id)\n                      FROM {user} u {$groupmembers}\n                     WHERE u.lastaccess > :timefrom\n                           AND u.lastaccess <= :now\n                           AND u.deleted = 0\n                           {$groupselect}";
     } else {
         // Course level - show only enrolled users for now.
         // TODO: add a new capability for viewing of all users (guests+enrolled+viewing).
         list($esqljoin, $eparams) = get_enrolled_sql($context);
         $params = array_merge($params, $eparams);
         $sql = "SELECT {$userfields} {$timeaccess}\n                      FROM {user_lastaccess} ul {$groupmembers}, {user} u\n                      JOIN ({$esqljoin}) euj ON euj.id = u.id\n                     WHERE ul.timeaccess > :timefrom\n                           AND u.id = ul.userid\n                           AND ul.courseid = :courseid\n                           AND ul.timeaccess <= :now\n                           AND u.deleted = 0\n                           {$groupselect} {$groupby}\n                  ORDER BY lastaccess DESC";
         $csql = "SELECT COUNT(u.id)\n                      FROM {user_lastaccess} ul {$groupmembers}, {user} u\n                      JOIN ({$esqljoin}) euj ON euj.id = u.id\n                     WHERE ul.timeaccess > :timefrom\n                           AND u.id = ul.userid\n                           AND ul.courseid = :courseid\n                           AND ul.timeaccess <= :now\n                           AND u.deleted = 0\n                           {$groupselect}";
         $params['courseid'] = $courseid;
     }
     $this->sql = $sql;
     $this->csql = $csql;
     $this->params = $params;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:48,代码来源:fetcher.php


示例13: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     global $DB, $PAGE;
     parent::__construct($uniqueid);
     // Block XP stuff.
     $this->xpmanager = block_xp_manager::get($courseid);
     $this->xpoutput = $PAGE->get_renderer('block_xp');
     $context = context_course::instance($courseid);
     // Define columns.
     $this->define_columns(array('userpic', 'fullname', 'lvl', 'xp', 'progress', 'actions'));
     $this->define_headers(array('', get_string('fullname'), get_string('level', 'block_xp'), get_string('xp', 'block_xp'), get_string('progress', 'block_xp'), ''));
     // Get the relevant user IDs, users enrolled or users with XP.
     // This might be a performance issue at some point.
     $ids = array();
     $users = get_enrolled_users($context, 'block/xp:earnxp');
     foreach ($users as $user) {
         $ids[$user->id] = $user->id;
     }
     unset($users);
     $entries = $DB->get_recordset_sql('SELECT userid FROM {block_xp} WHERE courseid = :courseid', array('courseid' => $courseid));
     foreach ($entries as $entry) {
         $ids[$entry->userid] = $entry->userid;
     }
     $entries->close();
     list($insql, $inparams) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED, 'param', true, null);
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = user_picture::fields('u') . ', x.lvl, x.xp';
     $this->sql->from = "{user} u LEFT JOIN {block_xp} x ON (x.userid = u.id AND x.courseid = :courseid)";
     $this->sql->where = "u.id {$insql}";
     $this->sql->params = array_merge($inparams, array('courseid' => $courseid));
     // Define various table settings.
     $this->sortable(true, 'lvl', SORT_DESC);
     $this->no_sorting('userpic');
     $this->no_sorting('progress');
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:42,代码来源:report_table.php


示例14: col_userpic

 /**
  * Formats the column userpic.
  *
  * @param stdClass $row Table row.
  * @return string Output produced.
  */
 protected function col_userpic($row)
 {
     global $CFG, $OUTPUT;
     if ($this->identitymode == block_xp_manager::IDENTITY_OFF && $this->userid != $row->userid) {
         static $guestuser = null;
         if ($guestuser === null) {
             $guestuser = guest_user();
         }
         return $OUTPUT->user_picture($guestuser, array('link' => false, 'alttext' => false));
     }
     return $OUTPUT->user_picture(user_picture::unalias($row, null, 'userid'));
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:18,代码来源:ladder_table.php


示例15: test_username_load_fields_from_object

 /**
  * Test function username_load_fields_from_object().
  */
 public function test_username_load_fields_from_object()
 {
     $this->resetAfterTest();
     // This object represents the information returned from an sql query.
     $userinfo = new stdClass();
     $userinfo->userid = 1;
     $userinfo->username = 'loosebruce';
     $userinfo->firstname = 'Bruce';
     $userinfo->lastname = 'Campbell';
     $userinfo->firstnamephonetic = 'ブルース';
     $userinfo->lastnamephonetic = 'カンベッル';
     $userinfo->middlename = '';
     $userinfo->alternatename = '';
     $userinfo->email = '';
     $userinfo->picture = 23;
     $userinfo->imagealt = 'Michael Jordan draining another basket.';
     $userinfo->idnumber = 3982;
     // Just user name fields.
     $user = new stdClass();
     $user = username_load_fields_from_object($user, $userinfo);
     $expectedarray = new stdClass();
     $expectedarray->firstname = 'Bruce';
     $expectedarray->lastname = 'Campbell';
     $expectedarray->firstnamephonetic = 'ブルース';
     $expectedarray->lastnamephonetic = 'カンベッル';
     $expectedarray->middlename = '';
     $expectedarray->alternatename = '';
     $this->assertEquals($user, $expectedarray);
     // User information for showing a picture.
     $user = new stdClass();
     $additionalfields = explode(',', user_picture::fields());
     $user = username_load_fields_from_object($user, $userinfo, null, $additionalfields);
     $user->id = $userinfo->userid;
     $expectedarray = new stdClass();
     $expectedarray->id = 1;
     $expectedarray->firstname = 'Bruce';
     $expectedarray->lastname = 'Campbell';
     $expectedarray->firstnamephonetic = 'ブルース';
     $expectedarray->lastnamephonetic = 'カンベッル';
     $expectedarray->middlename = '';
     $expectedarray->alternatename = '';
     $expectedarray->email = '';
     $expectedarray->picture = 23;
     $expectedarray->imagealt = 'Michael Jordan draining another basket.';
     $this->assertEquals($user, $expectedarray);
     // Alter the userinfo object to have a prefix.
     $userinfo->authorfirstname = 'Bruce';
     $userinfo->authorlastname = 'Campbell';
     $userinfo->authorfirstnamephonetic = 'ブルース';
     $userinfo->authorlastnamephonetic = 'カンベッル';
     $userinfo->authormiddlename = '';
     $userinfo->authorpicture = 23;
     $userinfo->authorimagealt = 'Michael Jordan draining another basket.';
     $userinfo->authoremail = '[email protected]';
     // Return an object with user picture information.
     $user = new stdClass();
     $additionalfields = explode(',', user_picture::fields());
     $user = username_load_fields_from_object($user, $userinfo, 'author', $additionalfields);
     $user->id = $userinfo->userid;
     $expectedarray = new stdClass();
     $expectedarray->id = 1;
     $expectedarray->firstname = 'Bruce';
     $expectedarray->lastname = 'Campbell';
     $expectedarray->firstnamephonetic = 'ブルース';
     $expectedarray->lastnamephonetic = 'カンベッル';
     $expectedarray->middlename = '';
     $expectedarray->alternatename = '';
     $expectedarray->email = '[email protected]';
     $expectedarray->picture = 23;
     $expectedarray->imagealt = 'Michael Jordan draining another basket.';
     $this->assertEquals($user, $expectedarray);
 }
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:75,代码来源:moodlelib_test.php


示例16: display_submissions


//.........这里部分代码省略.........
        //$table->set_attribute('align', 'center');

        $table->no_sorting('finalgrade');
        $table->no_sorting('outcome');

        // Start working -- this is necessary as soon as the niceties are over
        $table->setup();

        if (empty($users)) {
            echo $OUTPUT->heading(get_string('nosubmitusers','assignment'));
            echo '</div>';
            return true;
        }
        if ($this->assignment->assignmenttype=='upload' || $this->assignment->assignmenttype=='online' || $this->assignment->assignmenttype=='uploadsingle') { //TODO: this is an ugly hack, where is the plugin spirit? (skodak)
            echo '<div style="text-align:right"><a href="submissions.php?id='.$this->cm->id.'&amp;download=zip">'.get_string('downloadall', 'assignment').'</a></div>';
        }
    /// Construct the SQL

        list($where, $params) = $table->get_sql_where();
        if ($where) {
            $where .= ' AND ';
        }

        if ($filter == self::FILTER_SUBMITTED) {
           $where .= 's.timemodified > 0 AND ';
        } else if($filter == self::FILTER_REQUIRE_GRADING) {
           $where .= 's.timemarked < s.timemodified AND ';
        }

        if ($sort = $table->get_sql_sort()) {
            $sort = ' ORDER BY '.$sort;
        }

        $ufields = user_picture::fields('u');

        $select = "SELECT $ufields,
                          s.id AS submissionid, s.grade, s.submissioncomment,
                          s.timemodified, s.timemarked,
                          COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ";
        $sql = 'FROM {user} u '.
               'LEFT JOIN {assignment_submissions} s ON u.id = s.userid
                AND s.assignment = '.$this->assignment->id.' '.
               'WHERE '.$where.'u.id IN ('.implode(',',$users).') ';

        $ausers = $DB->get_records_sql($select.$sql.$sort, $params, $table->get_page_start(), $table->get_page_size());

        $table->pagesize($perpage, count($users));

        ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
        $offset = $page * $perpage;
        $strupdate = get_string('update');
        $strgrade  = get_string('grade');
        $grademenu = make_grades_menu($this->assignment->grade);

        if ($ausers !== false) {
            $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
            $endposition = $offset + $perpage;
            $currentposition = 0;
            foreach ($ausers as $auser) {
                if ($currentposition == $offset && $offset < $endposition) {
                    $final_grade = $grading_info->items[0]->grades[$auser->id];
                    $grademax = $grading_info->items[0]->grademax;
                    $final_grade->formatted_grade = round($final_grade->grade,2) .' / ' . round($grademax,2);
                    $locked_overridden = 'locked';
                    if ($final_grade->overridden) {
                        $locked_overridden = 'overridden';
开发者ID:nuckey,项目名称:moodle,代码行数:67,代码来源:lib.php


示例17: get_users

 /**
  * MDL-27591 made this method obsolete.
  */
 public function get_users($groupid = 0, $page = 1)
 {
     global $DB, $CFG;
     // Fields we need from the user table.
     $userfields = user_picture::fields('u', array('username', 'idnumber', 'institution', 'department'));
     if (isset($this->pageparams->sort) and $this->pageparams->sort == ATT_SORT_FIRSTNAME) {
         $orderby = "u.firstname ASC, u.lastname ASC, u.idnumber ASC, u.institution ASC, u.department ASC";
     } else {
         $orderby = "u.lastname ASC, u.firstname ASC, u.idnumber ASC, u.institution ASC, u.department ASC";
     }
     if ($page) {
         $usersperpage = $this->pageparams->perpage;
         if (!empty($CFG->enablegroupmembersonly) and $this->cm->groupmembersonly) {
             $startusers = ($page - 1) * $usersperpage;
             if ($groupid == 0) {
                 $groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id'));
             } else {
                 $groups = $groupid;
             }
             $users = get_users_by_capability($this->context, 'mod/attendance:canbelisted', $userfields . ',u.id, u.firstname, u.lastname, u.email', $orderby, $startusers, $usersperpage, $groups, '', false, true);
         } else {
             $startusers = ($page - 1) * $usersperpage;
             $users = get_enrolled_users($this->context, 'mod/attendance:canbelisted', $groupid, $userfields, $orderby, $startusers, $usersperpage);
         }
     } else {
         if (!empty($CFG->enablegroupmembersonly) and $this->cm->groupmembersonly) {
             if ($groupid == 0) {
                 $groups = array_keys(groups_get_all_groups($this->cm->course, 0, $this->cm->groupingid, 'g.id'));
             } else {
                 $groups = $groupid;
             }
             $users = get_users_by_capability($this->context, 'mod/attendance:canbelisted', $userfields . ',u.id, u.firstname, u.lastname, u.email', $orderby, '', '', $groups, '', false, true);
         } else {
             $users = get_enrolled_users($this->context, 'mod/attendance:canbelisted', $groupid, $userfields, $orderby);
         }
     }
     // Add a flag to each user indicating whether their enrolment is active.
     if (!empty($users)) {
         list($sql, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED, 'usid0');
         // See CONTRIB-4868.
         $mintime = 'MIN(CASE WHEN (ue.timestart > :zerotime) THEN ue.timestart ELSE ue.timecreated END)';
         $maxtime = 'CASE WHEN MIN(ue.timeend) = 0 THEN 0 ELSE MAX(ue.timeend) END';
         // See CONTRIB-3549.
         $sql = "SELECT ue.userid, MIN(ue.status) as status,\n                           {$mintime} AS mintime,\n                           {$maxtime} AS maxtime\n                      FROM {user_enrolments} ue\n                      JOIN {enrol} e ON e.id = ue.enrolid\n                     WHERE ue.userid {$sql}\n                           AND e.status = :estatus\n                           AND e.courseid = :courseid\n                  GROUP BY ue.userid";
         $params += array('zerotime' => 0, 'estatus' => ENROL_INSTANCE_ENABLED, 'courseid' => $this->course->id);
         $enrolments = $DB->get_records_sql($sql, $params);
         foreach ($users as $user) {
             $users[$user->id]->enrolmentstatus = $enrolments[$user->id]->status;
             $users[$user->id]->enrolmentstart = $enrolments[$user->id]->mintime;
             $users[$user->id]->enrolmentend = $enrolments[$user->id]->maxtime;
             $users[$user->id]->type = 'standard';
             // Mark as a standard (not a temporary) user.
         }
     }
     // Add the 'temporary' users to this list.
     $tempusers = $DB->get_records('attendance_tempusers', array('courseid' => $this->course->id));
     foreach ($tempusers as $tempuser) {
         $users[] = self::tempuser_to_user($tempuser);
     }
     return $users;
 }
开发者ID:webcursosuai,项目名称:moodle-mod_attendance,代码行数:64,代码来源:locallib.php


示例18: get_blocked_users

 /**
  * Retrieve a list of users blocked
  *
  * @param  int $userid the user whose blocked users we want to retrieve
  * @return external_description
  * @since 2.9
  */
 public static function get_blocked_users($userid)
 {
     global $CFG, $USER, $PAGE;
     // Warnings array, it can be empty at the end but is mandatory.
     $warnings = array();
     // Validate params.
     $params = array('userid' => $userid);
     $params = self::validate_parameters(self::get_blocked_users_parameters(), $params);
     $userid = $params['userid'];
     // Validate context.
     $context = context_system::instance();
     self::validate_context($context);
     // Check if private messaging between users is allowed.
     if (empty($CFG->messaging)) {
         throw new moodle_exception('disabled', 'message');
     }
     $user = core_user::get_user($userid, '*', MUST_EXIST);
     core_user::require_active_user($user);
     // Check if we have permissions for retrieve the information.
     if ($userid != $USER->id and !has_capability('moodle/site:readallmessages', $context)) {
         throw new moodle_exception('accessdenied', 'admin');
     }
     // Now, we can get safely all the blocked users.
     $users = message_get_blocked_users($user);
     $blockedusers = array();
     foreach ($users as $user) {
         $newuser = array('id' => $user->id, 'fullname' => fullname($user));
         $userpicture = new user_picture($user);
         $userpicture->size = 1;
         // Size f1.
         $newuser['profileimageurl'] = $userpicture->get_url($PAGE)->out(false);
         $blockedusers[] = $newuser;
     }
     $results = array('users' => $blockedusers, 'warnings' => $warnings);
     return $results;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:externallib.php


示例19: survey_get_user_answers

/**
 * @global object
 * @param int $surveyid
 * @param int $groupid
 * @param string $sort
 * @return array
 */
function survey_get_user_answers($surveyid, $questionid, $groupid, $sort="sa.answer1,sa.answer2 ASC") {
    global $DB;

    $params = array('surveyid'=>$surveyid, 'questionid'=>$questionid);

    if ($groupid) {
        $groupfrom = ', {groups_members} gm';
        $groupsql  = 'AND gm.groupid = :groupid AND u.id = gm.userid';
        $params['groupid'] = $groupid;
    } else {
        $groupfrom = '';
        $groupsql  = '';
    }

    $userfields = user_picture::fields('u');
    return $DB->get_records_sql("SELECT sa.*, $userfields
                                   FROM {survey_answers} sa,  {user} u $groupfrom
                                  WHERE sa.survey = :surveyid
                                        AND sa.question = :questionid
                                        AND u.id = sa.userid $groupsql
                               ORDER BY $sort", $params);
}
开发者ID:nitinnagaraja,项目名称:moodle,代码行数:29,代码来源:lib.php


示例20: list

    $table->sortable(true, 'firstname', SORT_ASC);
}
$table->no_sorting('roles');
$table->no_sorting('groups');
$table->no_sorting('groupings');
$table->no_sorting('select');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'participants');
$ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP user_selector_base类代码示例发布时间:2022-05-23
下一篇:
PHP user类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap