本文整理匯總了PHP中user_picture::unalias方法的典型用法代碼示例。如果您正苦於以下問題:PHP user_picture::unalias方法的具體用法?PHP user_picture::unalias怎麽用?PHP user_picture::unalias使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類user_picture
的用法示例。
在下文中一共展示了user_picture::unalias方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
示例2: test_user_picture_fields_unaliasing_null
public function test_user_picture_fields_unaliasing_null()
{
$fields = user_picture::fields();
$fields = array_map('trim', explode(',', $fields));
$fakerecord = new stdClass();
$fakerecord->aliasedid = 42;
foreach ($fields as $field) {
if ($field !== 'id') {
$fakerecord->{'prefix' . $field} = "Value of {$field}";
}
}
$fakerecord->prefixcustom1 = 'Value of custom1';
$fakerecord->prefiximagealt = null;
$returned = user_picture::unalias($fakerecord, array('custom1'), 'aliasedid', 'prefix');
$this->assertEqual($returned->id, 42);
$this->assertEqual($returned->imagealt, null);
foreach ($fields as $field) {
if ($field !== 'id' and $field !== 'imagealt') {
$this->assertEqual($returned->{$field}, "Value of {$field}");
}
}
$this->assertEqual($returned->custom1, 'Value of custom1');
}
示例3: 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'));
}
示例4: __construct
/**
* Extracts feedback from the given assessment record
*
* @param stdClass $assessment record as returned by eg {@see self::get_assessment_by_id()}
*/
public function __construct(stdClass $assessment)
{
$this->provider = user_picture::unalias($assessment, null, 'gradinggradeoverbyx', 'overby');
$this->content = $assessment->feedbackreviewer;
$this->format = $assessment->feedbackreviewerformat;
}
示例5: get_users_enrolments
/**
* Returns and array of users + enrolment details.
*
* Given an array of user id's this function returns and array of user enrolments for those users
* as well as enough user information to display the users name and picture for each enrolment.
*
* @global moodle_database $DB
* @param array $userids
* @return array
*/
public function get_users_enrolments(array $userids)
{
global $DB;
$instances = $this->get_enrolment_instances();
$plugins = $this->get_enrolment_plugins(false);
if (!empty($this->instancefilter)) {
$instancesql = ' = :instanceid';
$instanceparams = array('instanceid' => $this->instancefilter);
} else {
list($instancesql, $instanceparams) = $DB->get_in_or_equal(array_keys($instances), SQL_PARAMS_NAMED, 'instanceid0000');
}
$userfields = user_picture::fields('u');
list($idsql, $idparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED, 'userid0000');
list($sort, $sortparams) = users_order_by_sql('u');
$sql = "SELECT ue.id AS ueid, ue.status, ue.enrolid, ue.userid, ue.timestart, ue.timeend, ue.modifierid, ue.timecreated, ue.timemodified, {$userfields}\n FROM {user_enrolments} ue\n LEFT JOIN {user} u ON u.id = ue.userid\n WHERE ue.enrolid {$instancesql} AND\n u.id {$idsql}\n ORDER BY {$sort}";
$rs = $DB->get_recordset_sql($sql, $idparams + $instanceparams + $sortparams);
$users = array();
foreach ($rs as $ue) {
$user = user_picture::unalias($ue);
$ue->id = $ue->ueid;
unset($ue->ueid);
if (!array_key_exists($user->id, $users)) {
$user->enrolments = array();
$users[$user->id] = $user;
}
$ue->enrolmentinstance = $instances[$ue->enrolid];
$ue->enrolmentplugin = $plugins[$ue->enrolmentinstance->enrol];
$users[$user->id]->enrolments[$ue->id] = $ue;
}
$rs->close();
return $users;
}
示例6: data_print_template
/**
* takes a list of records, the current data, a search string,
* and mode to display prints the translated template
*
* @global object
* @global object
* @param string $template
* @param array $records
* @param object $data
* @param string $search
* @param int $page
* @param bool $return
* @param object $jumpurl a moodle_url by which to jump back to the record list (can be null)
* @return mixed
*/
function data_print_template($template, $records, $data, $search = '', $page = 0, $return = false, moodle_url $jumpurl = null)
{
global $CFG, $DB, $OUTPUT;
$cm = get_coursemodule_from_instance('data', $data->id);
$context = context_module::instance($cm->id);
static $fields = array();
static $dataid = null;
if (empty($dataid)) {
$dataid = $data->id;
} else {
if ($dataid != $data->id) {
$fields = array();
}
}
if (empty($fields)) {
$fieldrecords = $DB->get_records('data_fields', array('dataid' => $data->id));
foreach ($fieldrecords as $fieldrecord) {
$fields[] = data_get_field($fieldrecord, $data);
}
}
if (empty($records)) {
return;
}
if (!$jumpurl) {
$jumpurl = new moodle_url('/mod/data/view.php', array('d' => $data->id));
}
$jumpurl = new moodle_url($jumpurl, array('page' => $page, 'sesskey' => sesskey()));
foreach ($records as $record) {
// Might be just one for the single template
// Replacing tags
$patterns = array();
$replacement = array();
// Then we generate strings to replace for normal tags
foreach ($fields as $field) {
$patterns[] = '[[' . $field->field->name . ']]';
$replacement[] = highlight($search, $field->display_browse_field($record->id, $template));
}
$canmanageentries = has_capability('mod/data:manageentries', $context);
// Replacing special tags (##Edit##, ##Delete##, ##More##)
$patterns[] = '##edit##';
$patterns[] = '##delete##';
if (data_user_can_manage_entry($record, $data, $context)) {
$replacement[] = '<a href="' . $CFG->wwwroot . '/mod/data/edit.php?d=' . $data->id . '&rid=' . $record->id . '&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('t/edit') . '" class="iconsmall" alt="' . get_string('edit') . '" title="' . get_string('edit') . '" /></a>';
$replacement[] = '<a href="' . $CFG->wwwroot . '/mod/data/view.php?d=' . $data->id . '&delete=' . $record->id . '&sesskey=' . sesskey() . '"><img src="' . $OUTPUT->pix_url('t/delete') . '" class="iconsmall" alt="' . get_string('delete') . '" title="' . get_string('delete') . '" /></a>';
} else {
$replacement[] = '';
$replacement[] = '';
}
$moreurl = $CFG->wwwroot . '/mod/data/view.php?d=' . $data->id . '&rid=' . $record->id;
if ($search) {
$moreurl .= '&filter=1';
}
$patterns[] = '##more##';
$replacement[] = '<a href="' . $moreurl . '"><img src="' . $OUTPUT->pix_url('t/preview') . '" class="iconsmall" alt="' . get_string('more', 'data') . '" title="' . get_string('more', 'data') . '" /></a>';
$patterns[] = '##moreurl##';
$replacement[] = $moreurl;
$patterns[] = '##delcheck##';
if ($canmanageentries) {
$replacement[] = html_writer::checkbox('delcheck[]', $record->id, false, '', array('class' => 'recordcheckbox'));
} else {
$replacement[] = '';
}
$patterns[] = '##user##';
$replacement[] = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $record->userid . '&course=' . $data->course . '">' . fullname($record) . '</a>';
$patterns[] = '##userpicture##';
$ruser = user_picture::unalias($record, null, 'userid');
$replacement[] = $OUTPUT->user_picture($ruser, array('courseid' => $data->course));
$patterns[] = '##export##';
if (!empty($CFG->enableportfolios) && ($template == 'singletemplate' || $template == 'listtemplate') && (has_capability('mod/data:exportentry', $context) || data_isowner($record->id) && has_capability('mod/data:exportownentry', $context))) {
require_once $CFG->libdir . '/portfoliolib.php';
$button = new portfolio_add_button();
$button->set_callback_options('data_portfolio_caller', array('id' => $cm->id, 'recordid' => $record->id), 'mod_data');
list($formats, $files) = data_portfolio_caller::formats($fields, $record);
$button->set_formats($formats);
$replacement[] = $button->to_html(PORTFOLIO_ADD_ICON_LINK);
} else {
$replacement[] = '';
}
$patterns[] = '##timeadded##';
$replacement[] = userdate($record->timecreated);
$patterns[] = '##timemodified##';
$replacement[] = userdate($record->timemodified);
$patterns[] = '##approve##';
if (has_capability('mod/data:approve', $context) && $data->approval && !$record->approved) {
$approveurl = new moodle_url($jumpurl, array('approve' => $record->id));
//.........這裏部分代碼省略.........
示例7: get_user_messages
/**
* Get a user's messages read and unread.
*
* @param int $userid
* @return message[]
*/
public static function get_user_messages($userid)
{
global $DB;
$select = 'm.id, m.useridfrom, m.useridto, m.subject, m.fullmessage, m.fullmessageformat, m.fullmessagehtml, ' . 'm.smallmessage, m.timecreated, m.notification, m.contexturl, m.contexturlname, ' . \user_picture::fields('u', null, 'useridfrom', 'fromuser');
$records = $DB->get_records_sql("\n (\n SELECT {$select}, 1 unread\n FROM {message} m\n INNER JOIN {user} u ON u.id = m.useridfrom\n WHERE m.useridto = ?\n AND contexturl IS NULL\n ) UNION ALL (\n SELECT {$select}, 0 unread\n FROM {message_read} m\n INNER JOIN {user} u ON u.id = m.useridfrom\n WHERE m.useridto = ?\n AND contexturl IS NULL\n )\n ORDER BY timecreated DESC\n ", array($userid, $userid), 0, 5);
$messages = array();
foreach ($records as $record) {
$message = new message($record);
$message->set_fromuser(\user_picture::unalias($record, null, 'useridfrom', 'fromuser'));
$messages[] = $message;
}
return $messages;
}
示例8: feedback_get_recent_mod_activity
//.........這裏部分代碼省略.........
* @param int $cmid
* @param int $userid
* @param int $groupid
* @return void
*/
function feedback_get_recent_mod_activity(&$activities, &$index,
$timemodified, $courseid,
$cmid, $userid="", $groupid="") {
global $CFG, $COURSE, $USER, $DB;
if ($COURSE->id == $courseid) {
$course = $COURSE;
} else {
$course = $DB->get_record('course', array('id'=>$courseid));
}
$modinfo = get_fast_modinfo($course);
$cm = $modinfo->cms[$cmid];
$sqlargs = array();
$userfields = user_picture::fields('u', null, 'useridagain');
$sql = " SELECT fk . * , fc . * , $userfields
FROM {feedback_completed} fc
JOIN {feedback} fk ON fk.id = fc.feedback
JOIN {user} u ON u.id = fc.userid ";
if ($groupid) {
$sql .= " JOIN {groups_members} gm ON gm.userid=u.id ";
}
$sql .= " WHERE fc.timemodified > ? AND fk.id = ? ";
$sqlargs[] = $timemodified;
$sqlargs[] = $cm->instance;
if ($userid) {
$sql .= " AND u.id = ? ";
$sqlargs[] = $userid;
}
if ($groupid) {
$sql .= " AND gm.groupid = ? ";
$sqlargs[] = $groupid;
}
if (!$feedbackitems = $DB->get_records_sql($sql, $sqlargs)) {
return;
}
$cm_context = context_module::instance($cm->id);
if (!has_capability('mod/feedback:view', $cm_context)) {
return;
}
$accessallgroups = has_capability('moodle/site:accessallgroups', $cm_context);
$viewfullnames = has_capability('moodle/site:viewfullnames', $cm_context);
$groupmode = groups_get_activity_groupmode($cm, $course);
$aname = format_string($cm->name, true);
foreach ($feedbackitems as $feedbackitem) {
if ($feedbackitem->userid != $USER->id) {
if ($groupmode == SEPARATEGROUPS and !$accessallgroups) {
$usersgroups = groups_get_all_groups($course->id,
$feedbackitem->userid,
$cm->groupingid);
if (!is_array($usersgroups)) {
continue;
}
$usersgroups = array_keys($usersgroups);
$intersect = array_intersect($usersgroups, $modinfo->get_groups($cm->groupingid));
if (empty($intersect)) {
continue;
}
}
}
$tmpactivity = new stdClass();
$tmpactivity->type = 'feedback';
$tmpactivity->cmid = $cm->id;
$tmpactivity->name = $aname;
$tmpactivity->sectionnum= $cm->sectionnum;
$tmpactivity->timestamp = $feedbackitem->timemodified;
$tmpactivity->content = new stdClass();
$tmpactivity->content->feedbackid = $feedbackitem->id;
$tmpactivity->content->feedbackuserid = $feedbackitem->userid;
$tmpactivity->user = user_picture::unalias($feedbackitem, null, 'useridagain');
$tmpactivity->user->fullname = fullname($feedbackitem, $viewfullnames);
$activities[$index++] = $tmpactivity;
}
return;
}
示例9: glossary_get_recent_mod_activity
//.........這裏部分代碼省略.........
$modinfo = get_fast_modinfo($course);
$cm = $modinfo->cms[$cmid];
$context = context_module::instance($cm->id);
if (!$cm->uservisible) {
return;
}
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
// Groups are not yet supported for glossary. See MDL-10728 .
/*
$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
$groupmode = groups_get_activity_groupmode($cm, $course);
*/
$params['timestart'] = $timestart;
if ($userid) {
$userselect = "AND u.id = :userid";
$params['userid'] = $userid;
} else {
$userselect = '';
}
if ($groupid) {
$groupselect = 'AND gm.groupid = :groupid';
$groupjoin = 'JOIN {groups_members} gm ON gm.userid=u.id';
$params['groupid'] = $groupid;
} else {
$groupselect = '';
$groupjoin = '';
}
$approvedselect = "";
if (!has_capability('mod/glossary:approve', $context)) {
$approvedselect = " AND ge.approved = 1 ";
}
$params['timestart'] = $timestart;
$params['glossaryid'] = $cm->instance;
$ufields = user_picture::fields('u', null, 'userid');
$entries = $DB->get_records_sql("
SELECT ge.id AS entryid, ge.glossaryid, ge.concept, ge.definition, ge.approved,
ge.timemodified, $ufields
FROM {glossary_entries} ge
JOIN {user} u ON u.id = ge.userid
$groupjoin
WHERE ge.timemodified > :timestart
AND ge.glossaryid = :glossaryid
$approvedselect
$userselect
$groupselect
ORDER BY ge.timemodified ASC", $params);
if (!$entries) {
return;
}
foreach ($entries as $entry) {
// Groups are not yet supported for glossary. See MDL-10728 .
/*
$usersgroups = null;
if ($entry->userid != $USER->id) {
if ($groupmode == SEPARATEGROUPS and !$accessallgroups) {
if (is_null($usersgroups)) {
$usersgroups = groups_get_all_groups($course->id, $entry->userid, $cm->groupingid);
if (is_array($usersgroups)) {
$usersgroups = array_keys($usersgroups);
} else {
$usersgroups = array();
}
}
if (!array_intersect($usersgroups, $modinfo->get_groups($cm->groupingid))) {
continue;
}
}
}
*/
$tmpactivity = new stdClass();
$tmpactivity->user = user_picture::unalias($entry, null, 'userid');
$tmpactivity->user->fullname = fullname($tmpactivity->user, $viewfullnames);
$tmpactivity->type = 'glossary';
$tmpactivity->cmid = $cm->id;
$tmpactivity->glossaryid = $entry->glossaryid;
$tmpactivity->name = format_string($cm->name, true);
$tmpactivity->sectionnum = $cm->sectionnum;
$tmpactivity->timestamp = $entry->timemodified;
$tmpactivity->content = new stdClass();
$tmpactivity->content->entryid = $entry->entryid;
$tmpactivity->content->concept = $entry->concept;
$tmpactivity->content->definition = $entry->definition;
$tmpactivity->content->approved = $entry->approved;
$activities[$index++] = $tmpactivity;
}
return true;
}
示例10: quiz_get_recent_mod_activity
/**
* Returns all quiz graded users since a given time for specified quiz
*/
function quiz_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0)
{
global $CFG, $USER, $DB;
require_once $CFG->dirroot . '/mod/quiz/locallib.php';
$course = get_course($courseid);
$modinfo = get_fast_modinfo($course);
$cm = $modinfo->cms[$cmid];
$quiz = $DB->get_record('quiz', array('id' => $cm->instance));
if ($userid) {
$userselect = "AND u.id = :userid";
$params['userid'] = $userid;
} else {
$userselect = '';
}
if ($groupid) {
$groupselect = 'AND gm.groupid = :groupid';
$groupjoin = 'JOIN {groups_members} gm ON gm.userid=u.id';
$params['groupid'] = $groupid;
} else {
$groupselect = '';
$groupjoin = '';
}
$params['timestart'] = $timestart;
$params['quizid'] = $quiz->id;
$ufields = user_picture::fields('u', null, 'useridagain');
if (!($attempts = $DB->get_records_sql("\n SELECT qa.*,\n {$ufields}\n FROM {quiz_attempts} qa\n JOIN {user} u ON u.id = qa.userid\n {$groupjoin}\n WHERE qa.timefinish > :timestart\n AND qa.quiz = :quizid\n AND qa.preview = 0\n {$userselect}\n {$groupselect}\n ORDER BY qa.timefinish ASC", $params))) {
return;
}
$context = context_module::instance($cm->id);
$accessallgroups = has_capability('moodle/site:accessallgroups', $context);
$viewfullnames = has_capability('moodle/site:viewfullnames', $context);
$grader = has_capability('mod/quiz:viewreports', $context);
$groupmode = groups_get_activity_groupmode($cm, $course);
$usersgroups = null;
$aname = format_string($cm->name, true);
foreach ($attempts as $attempt) {
if ($attempt->userid != $USER->id) {
if (!$grader) {
// Grade permission required.
continue;
}
if ($groupmode == SEPARATEGROUPS and !$accessallgroups) {
$usersgroups = groups_get_all_groups($course->id, $attempt->userid, $cm->groupingid);
$usersgroups = array_keys($usersgroups);
if (!array_intersect($usersgroups, $modinfo->get_groups($cm->groupingid))) {
continue;
}
}
}
$options = quiz_get_review_options($quiz, $attempt, $context);
$tmpactivity = new stdClass();
$tmpactivity->type = 'quiz';
$tmpactivity->cmid = $cm->id;
$tmpactivity->name = $aname;
$tmpactivity->sectionnum = $cm->sectionnum;
$tmpactivity->timestamp = $attempt->timefinish;
$tmpactivity->content = new stdClass();
$tmpactivity->content->attemptid = $attempt->id;
$tmpactivity->content->attempt = $attempt->attempt;
if (quiz_has_grades($quiz) && $options->marks >= question_display_options::MARK_AND_MAX) {
$tmpactivity->content->sumgrades = quiz_format_grade($quiz, $attempt->sumgrades);
$tmpactivity->content->maxgrade = quiz_format_grade($quiz, $quiz->sumgrades);
} else {
$tmpactivity->content->sumgrades = null;
$tmpactivity->content->maxgrade = null;
}
$tmpactivity->user = user_picture::unalias($attempt, null, 'useridagain');
$tmpactivity->user->fullname = fullname($tmpactivity->user, $viewfullnames);
$activities[$index++] = $tmpactivity;
}
}
示例11: col_userpic
/**
* Prepares column userpic for display
* @param stdClass $row
* @return string
*/
public function col_userpic($row)
{
global $OUTPUT;
$user = user_picture::unalias($row, [], $this->useridfield);
return $OUTPUT->user_picture($user, array('courseid' => $this->feedbackstructure->get_cm()->course));
}
示例12: create_contact
/**
* Helper function for creating a contact object.
*
* @param \stdClass $contact
* @param string $prefix
* @return \stdClass
*/
public static function create_contact($contact, $prefix = '')
{
global $PAGE;
// Create the data we are going to pass to the renderable.
$userfields = \user_picture::unalias($contact, array('lastaccess'), $prefix . 'id', $prefix);
$data = new \stdClass();
$data->userid = $userfields->id;
$data->useridfrom = null;
$data->fullname = fullname($userfields);
// Get the user picture data.
$userpicture = new \user_picture($userfields);
$userpicture->size = 1;
// Size f1.
$data->profileimageurl = $userpicture->get_url($PAGE)->out(false);
$userpicture->size = 0;
// Size f2.
$data->profileimageurlsmall = $userpicture->get_url($PAGE)->out(false);
// Store the message if we have it.
$data->ismessaging = false;
$data->lastmessage = null;
$data->messageid = null;
if (isset($contact->smallmessage)) {
$data->ismessaging = true;
// Strip the HTML tags from the message for displaying in the contact area.
$data->lastmessage = clean_param($contact->smallmessage, PARAM_NOTAGS);
$data->useridfrom = $contact->useridfrom;
if (isset($contact->messageid)) {
$data->messageid = $contact->messageid;
}
}
// Check if the user is online.
$data->isonline = self::is_online($userfields->lastaccess);
$data->isblocked = isset($contact->blocked) ? (bool) $contact->blocked : false;
$data->isread = isset($contact->isread) ? (bool) $contact->isread : false;
$data->unreadcount = isset($contact->unreadcount) ? $contact->unreadcount : null;
return $data;
}
示例13: get_user_messages
/**
* Get a user's messages read and unread.
*
* @param int $userid
* @param int $since optional timestamp, only return newer messages
* @return message[]
*/
public static function get_user_messages($userid, $since = null)
{
global $DB;
if ($since === null) {
$since = time() - 12 * WEEKSECS;
}
$select = 'm.id, m.useridfrom, m.useridto, m.subject, m.fullmessage, m.fullmessageformat, m.fullmessagehtml, ' . 'm.smallmessage, m.timecreated, m.notification, m.contexturl, m.contexturlname, ' . \user_picture::fields('u', null, 'useridfrom', 'fromuser');
$sql = "\n (\n SELECT {$select}, 1 unread\n FROM {message} m\n INNER JOIN {user} u ON u.id = m.useridfrom AND u.deleted = 0\n WHERE m.useridto = :userid1\n AND contexturl IS NULL\n AND m.timecreated > :fromdate1\n AND m.timeusertodeleted = 0\n ) UNION ALL (\n SELECT {$select}, 0 unread\n FROM {message_read} m\n INNER JOIN {user} u ON u.id = m.useridfrom AND u.deleted = 0\n WHERE m.useridto = :userid2\n AND contexturl IS NULL\n AND m.timecreated > :fromdate2\n AND m.timeusertodeleted = 0\n )\n ORDER BY timecreated DESC";
$params = array('userid1' => $userid, 'userid2' => $userid, 'fromdate1' => $since, 'fromdate2' => $since);
$records = $DB->get_records_sql($sql, $params, 0, 5);
$messages = array();
foreach ($records as $record) {
$message = new message($record);
$message->set_fromuser(\user_picture::unalias($record, null, 'useridfrom', 'fromuser'));
$messages[] = $message;
}
return $messages;
}
示例14: get_user_from_record
/**
* Retrieve a user object from a record.
*
* This comes handy when {@link self::add_user_fields} was used.
*
* @param stdClass $record The record.
* @return stdClass A user object.
*/
public static function get_user_from_record($record)
{
return user_picture::unalias($record, null, 'userdataid', 'userdata');
}
示例15: array
$table->attributes['class'] = 'generaltable contributionlist submitted';
$table->head = array(get_string('contribid', 'local_amos'), get_string('contribstatus', 'local_amos'), get_string('contribsubject', 'local_amos'), get_string('contribtimemodified', 'local_amos'), get_string('contribassignee', 'local_amos'), get_string('language', 'local_amos'), get_string('strings', 'local_amos'));
$table->colclasses = array('id', 'status', 'subject', 'timemodified', 'assignee', 'language', 'strings');
foreach ($contributions as $contribution) {
$url = new moodle_url($PAGE->url, array('id' => $contribution->id));
$cells = array();
$cells[] = new html_table_cell(html_writer::link($url, '#' . $contribution->id));
$status = get_string('contribstatus' . $contribution->status, 'local_amos');
$cells[] = new html_table_cell(html_writer::link($url, $status));
$cells[] = new html_table_cell(html_writer::link($url, s($contribution->subject)));
$time = is_null($contribution->timemodified) ? $contribution->timecreated : $contribution->timemodified;
$cells[] = new html_table_cell(userdate($time, get_string('strftimedaydatetime', 'langconfig')));
if (is_null($contribution->assigneeid)) {
$assignee = get_string('contribassigneenone', 'local_amos');
} else {
$assignee = new user_picture(user_picture::unalias($contribution, null, 'assigneeid', 'assignee'));
$assignee->size = 16;
$assignee = $output->render($assignee) . s(fullname($assignee->user));
}
$cells[] = new html_table_cell($assignee);
$cells[] = new html_table_cell(s($contribution->lang));
$cells[] = new html_table_cell(s($contribution->strings));
$row = new html_table_row($cells);
$row->attributes['class'] = 'status' . $contribution->status;
$table->data[] = $row;
}
echo $output->heading(get_string('contribsubmittedsome', 'local_amos', count($contributions)));
echo html_writer::table($table);
}
if ($closed) {
echo $output->single_button(new moodle_url($PAGE->url, array('closed' => false)), get_string('contribclosedno', 'local_amos'), 'get', array('class' => 'singlebutton showclosed'));