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

PHP get_all_user_name_fields函数代码示例

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

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



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

示例1: local_loginas_extends_settings_navigation

/**
 * Adds module specific settings to the settings block.
 *
 * @param settings_navigation $settings The settings navigation object
 * @param stdClass $context The node context
 */
function local_loginas_extends_settings_navigation(settings_navigation $settings, $context)
{
    global $DB, $CFG, $PAGE, $USER;
    // Course id and context.
    $courseid = !empty($PAGE->course->id) ? $PAGE->course->id : SITEID;
    $coursecontext = context_course::instance($courseid);
    // Must have the loginas capability.
    if (!has_capability('moodle/user:loginas', $coursecontext)) {
        return;
    }
    // Set the settings category.
    $loginas = $settings->add(get_string('loginas'));
    // Login as list by admin setting.
    if (is_siteadmin($USER)) {
        // Admin settings page.
        $url = new moodle_url('/admin/settings.php', array('section' => 'localsettingloginas'));
        $loginas->add(get_string('settings'), $url, $settings::TYPE_SETTING);
        // Users list.
        $loginasusers = array();
        // Since 2.6, use all the required fields.
        $ufields = 'id, ' . get_all_user_name_fields(true);
        // Get users by id.
        if ($configuserids = get_config('local_loginas', 'loginasusers')) {
            $userids = explode(',', $configuserids);
            if ($users = $DB->get_records_list('user', 'id', $userids, '', $ufields)) {
                $loginasusers = $users;
            }
        }
        // Get users by username.
        if ($configusernames = get_config('local_loginas', 'loginasusernames')) {
            $usernames = explode(',', $configusernames);
            if ($users = $DB->get_records_list('user', 'username', $usernames, '', $ufields)) {
                $loginasusers = $loginasusers + $users;
            }
        }
        // Add action links for specified users.
        if ($loginasusers) {
            $params = array('id' => $courseid, 'sesskey' => sesskey());
            foreach ($loginasusers as $userid => $lauser) {
                $url = new moodle_url('/course/loginas.php', $params);
                $url->param('user', $userid);
                $loginas->add(fullname($lauser, true), $url, $settings::TYPE_SETTING);
            }
        }
    }
    // Course users login as.
    if (!($configcourseusers = get_config('local_loginas', 'courseusers'))) {
        return;
    }
    $loggedinas = \core\session\manager::is_loggedinas();
    if (!$loggedinas) {
        // Ajax link.
        $node = $loginas->add(get_string('courseusers', 'local_loginas'), 'javascript:void();', $settings::TYPE_SETTING);
        $node->add_class('local_loginas_setting_link');
        local_loginas_require_js($PAGE);
    }
}
开发者ID:keliix06,项目名称:moodle-local_loginas,代码行数:63,代码来源:lib.php


示例2: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  * @param int $courseid Course ID.
  * @param int $groupid Group ID.
  */
 public function __construct($uniqueid, $courseid, $groupid)
 {
     parent::__construct($uniqueid);
     $this->courseid = $courseid;
     // Define columns.
     $this->define_columns(array('time', 'fullname', 'xp', 'eventname'));
     $this->define_headers(array(get_string('eventtime', 'block_xp'), get_string('fullname'), get_string('xp', 'block_xp'), get_string('eventname', 'block_xp')));
     // Define SQL.
     $sqlfrom = '';
     $sqlparams = array();
     if ($groupid) {
         $sqlfrom = '{block_xp_log} x
                  JOIN {groups_members} gm
                    ON gm.groupid = :groupid
                   AND gm.userid = x.userid
             LEFT JOIN {user} u
                    ON x.userid = u.id';
         $sqlparams = array('groupid' => $groupid);
     } else {
         $sqlfrom = '{block_xp_log} x LEFT JOIN {user} u ON x.userid = u.id';
     }
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . get_all_user_name_fields(true, 'u');
     $this->sql->from = $sqlfrom;
     $this->sql->where = 'courseid = :courseid';
     $this->sql->params = array_merge(array('courseid' => $courseid), $sqlparams);
     // Define various table settings.
     $this->sortable(true, 'time', SORT_DESC);
     $this->collapsible(false);
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:38,代码来源:log_table.php


示例3: get_comments

 /**
  * Return comments by pages
  *
  * @global moodle_database $DB
  * @param int $page
  * @return array An array of comments
  */
 function get_comments($page)
 {
     global $DB;
     if ($page == 0) {
         $start = 0;
     } else {
         $start = $page * $this->perpage;
     }
     $comments = array();
     $usernamefields = get_all_user_name_fields(true, 'u');
     $sql = "SELECT c.id, c.contextid, c.itemid, c.component, c.commentarea, c.userid, c.content, {$usernamefields}, c.timecreated\n                  FROM {comments} c\n                  JOIN {user} u\n                       ON u.id=c.userid\n              ORDER BY c.timecreated ASC";
     $rs = $DB->get_recordset_sql($sql, null, $start, $this->perpage);
     $formatoptions = array('overflowdiv' => true);
     foreach ($rs as $item) {
         // Set calculated fields
         $item->fullname = fullname($item);
         $item->time = userdate($item->timecreated);
         $item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
         // Unset fields not related to the comment
         foreach (get_all_user_name_fields() as $namefield) {
             unset($item->{$namefield});
         }
         unset($item->timecreated);
         // Record the comment
         $comments[] = $item;
     }
     $rs->close();
     return $comments;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:36,代码来源:locallib.php


示例4: php_report_schedule_export_instance

/**
 * Runs and exports, through email, the report instance specified by the
 * provided report schedule
 *
 * @param   stdClass  $report_schedule  The PHP report schedule containing the information
 *                                      about the specific report to be exported
 *
 * @return  boolean                     true on success, otherwise false
 */
function php_report_schedule_export_instance($report_schedule, $now = 0) {
    global $CFG, $USER;

    if ($now == 0) {
        $now = time();
    }

    $data = unserialize($report_schedule->config);

    // Create report to be emailed to recipient
    $shortname = $report_schedule->report;
    $format = $data['format'];
    // Initialize a temp path name
    $tmppath = '/temp';
    // Create a unique temporary filename to use for this schedule
    $filename = tempnam($CFG->dataroot.$tmppath, 'php_report_');

    $parameterdata = $data['parameters'];

    // Generate the report file
    $result = php_report::export_default_instance($shortname, $format, $filename, $parameterdata, $report_schedule->userid, php_report::EXECUTION_MODE_SCHEDULED);

    if (!$result) {
        //handle failure case
        unlink($filename);
        return false;
    }

    // Attach filename to an email - so get recipient...
    $recipients_array = explode(',',$data['recipients']);
    $from = get_string('noreplyname');
    $subject = get_string('email_subject','local_elisreports').$data['label'];
    $messagetext = html_to_text($data['message']);
    $messagehtml = $data['message'];
    $start = strlen($CFG->dataroot);
    $attachment = substr($filename,$start);
    $attachname = $report_schedule->report.$now.'.'.$data['format'];

    // $user->id & all other fields now required by Moodle 2.6+ email_to_user() API which also calls fullname($user)
    $user = new stdClass;
    $allfields = get_all_user_name_fields();
    foreach ($allfields as $field) {
        $user->$field = null;
    }
    $user->id = $USER->id; // let's just use this user as default (TBD)
    $user->mailformat = 1;

    // Attach the file to the recipients
    foreach ($recipients_array as $recipient) {
        $user->email = trim($recipient);
        email_to_user($user, $from, $subject, $messagetext, $messagehtml, $attachment, $attachname);
    }

    // Remove the file that was created for this report
    unlink($filename);

    return true;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:67,代码来源:runschedule.php


示例5: get_required_fields

 public function get_required_fields()
 {
     $allnames = get_all_user_name_fields();
     $requiredfields = array();
     foreach ($allnames as $allname) {
         $requiredfields[] = 'um.' . $allname . ' AS modifier' . $allname;
     }
     return $requiredfields;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:9,代码来源:modifier_name_column.php


示例6: get_required_fields

 public function get_required_fields()
 {
     $allnames = get_all_user_name_fields();
     $requiredfields = array();
     foreach ($allnames as $allname) {
         $requiredfields[] = 'uc.' . $allname . ' AS creator' . $allname;
     }
     $requiredfields[] = 'q.timecreated';
     return $requiredfields;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:10,代码来源:creator_name_column.php


示例7: __construct

 /**
  * Constructor.
  *
  * @param int $currentuserid The current user we are wanting to view messages for
  * @param int $otheruserid The other user we are wanting to view messages for
  * @param array $messages
  */
 public function __construct($currentuserid, $otheruserid, $messages)
 {
     $ufields = 'id, ' . get_all_user_name_fields(true) . ', lastaccess';
     $this->currentuserid = $currentuserid;
     if ($otheruserid) {
         $this->otheruserid = $otheruserid;
         $this->otheruser = \core_user::get_user($otheruserid, $ufields, MUST_EXIST);
     }
     $this->messages = $messages;
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:17,代码来源:messages.php


示例8: local_hub_create_contact_user

/**
 * Construct an object to supply to email_to_user()
 *
 * @param string $email the required email address
 * @param string $firstname The desired user first name
 * @return stdClass An object that can be supplied to email_to_user()
 */
function local_hub_create_contact_user($email, $firstname)
{
    $contactuser = new stdClass();
    // Need an id, can't use id=0. would rather not use id=1, lets fool the api while we're still trying to use a fake user to send to.
    $contactuser->id = 2;
    // Used to retrieve the mailcharset user preference which defaults to 0.
    $contactuser->email = $email;
    $contactuser->firstname = $firstname;
    $contactuser->lastname = '';
    foreach (get_all_user_name_fields() as $namefield) {
        if (!isset($contactuser->{$namefield})) {
            $contactuser->{$namefield} = '';
        }
    }
    return $contactuser;
}
开发者ID:scyrma,项目名称:moodle-local_hub,代码行数:23,代码来源:locallib.php


示例9: __construct

 /**
  * Constructor.
  *
  * @param string $uniqueid Unique ID.
  */
 public function __construct($uniqueid, $courseid)
 {
     parent::__construct($uniqueid);
     $this->courseid = $courseid;
     // Define columns.
     $this->define_columns(array('time', 'fullname', 'xp', 'eventname', 'actions'));
     $this->define_headers(array(get_string('eventtime', 'block_xp'), get_string('fullname'), get_string('xp', 'block_xp'), get_string('eventname', 'block_xp'), ''));
     // Define SQL.
     $this->sql = new stdClass();
     $this->sql->fields = 'x.*, ' . get_all_user_name_fields(true, 'u');
     $this->sql->from = '{block_xp_log} 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(true, 'time', SORT_DESC);
     $this->collapsible(false);
 }
开发者ID:scarletjester,项目名称:moodle-block_xp,代码行数:22,代码来源:log_table.php


示例10: get_content

 function get_content()
 {
     global $CFG, $USER, $DB;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     // get all the mentees, i.e. users you have a direct assignment to
     $allusernames = get_all_user_name_fields(true, 'u');
     if ($usercontexts = $DB->get_records_sql("SELECT c.instanceid, c.instanceid, {$allusernames}\n                                                    FROM {role_assignments} ra, {context} c, {user} u\n                                                   WHERE ra.userid = ?\n                                                         AND ra.contextid = c.id\n                                                         AND c.instanceid = u.id\n                                                         AND c.contextlevel = " . CONTEXT_USER, array($USER->id))) {
         $this->content->text = '<ul>';
         foreach ($usercontexts as $usercontext) {
             $this->content->text .= '<li><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $usercontext->instanceid . '&amp;course=' . SITEID . '">' . fullname($usercontext) . '</a></li>';
         }
         $this->content->text .= '</ul>';
     }
     $this->content->footer = '';
     return $this->content;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:block_mentees.php


示例11: definition

 public function definition()
 {
     global $COURSE;
     $context = context_course::instance($COURSE->id);
     $namefields = get_all_user_name_fields(true, 'u');
     $students = get_enrolled_users($context, 'mod/attendance:canbelisted', 0, 'u.id,' . $namefields . ',u.email', 'u.lastname, u.firstname', 0, 0, true);
     $partarray = array();
     foreach ($students as $student) {
         $partarray[$student->id] = fullname($student) . ' (' . $student->email . ')';
     }
     $mform = $this->_form;
     $description = $this->_customdata['description'];
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'userid', 0);
     $mform->setType('userid', PARAM_INT);
     $mform->addElement('header', 'attheader', get_string('tempusermerge', 'attendance'));
     $mform->addElement('static', 'description', get_string('tempuser', 'attendance'), $description);
     $mform->addElement('select', 'participant', get_string('participant', 'attendance'), $partarray);
     $mform->addElement('static', 'requiredentries', '', get_string('requiredentries', 'attendance'));
     $mform->addHelpButton('requiredentries', 'requiredentry', 'attendance');
     $this->add_action_buttons(true, get_string('mergeuser', 'attendance'));
 }
开发者ID:webcursosuai,项目名称:moodle-mod_attendance,代码行数:23,代码来源:tempmerge_form.php


示例12: execute

 /**
  * Do the job.
  * Throw exceptions on errors (the job will be retried).
  */
 public function execute()
 {
     global $DB;
     // Generate new password emails for users - ppl expect these generated asap.
     if ($DB->count_records('user_preferences', array('name' => 'create_password', 'value' => '1'))) {
         mtrace('Creating passwords for new users...');
         $usernamefields = get_all_user_name_fields(true, 'u');
         $newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, u.auth, u.deleted,\n                                                     u.suspended, u.emailstop, u.mnethostid, u.mailformat,\n                                                     {$usernamefields}, u.username, u.lang,\n                                                     p.id as prefid\n                                                FROM {user} u\n                                                JOIN {user_preferences} p ON u.id=p.userid\n                                               WHERE p.name='create_password' AND p.value='1' AND\n                                                     u.email !='' AND u.suspended = 0 AND\n                                                     u.auth != 'nologin' AND u.deleted = 0");
         // Note: we can not send emails to suspended accounts.
         foreach ($newusers as $newuser) {
             // Use a low cost factor when generating bcrypt hash otherwise
             // hashing would be slow when emailing lots of users. Hashes
             // will be automatically updated to a higher cost factor the first
             // time the user logs in.
             if (setnew_password_and_mail($newuser, true)) {
                 unset_user_preference('create_password', $newuser);
                 set_user_preference('auth_forcepasswordchange', 1, $newuser);
             } else {
                 trigger_error("Could not create and mail new user password!");
             }
         }
         $newusers->close();
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:send_new_user_passwords_task.php


示例13: get_role_users

/**
 * Gets all the users assigned this role in this context or higher
 *
 * @param int $roleid (can also be an array of ints!)
 * @param context $context
 * @param bool $parent if true, get list of users assigned in higher context too
 * @param string $fields fields from user (u.) , role assignment (ra) or role (r.)
 * @param string $sort sort from user (u.) , role assignment (ra.) or role (r.).
 *      null => use default sort from users_order_by_sql.
 * @param bool $all true means all, false means limit to enrolled users
 * @param string $group defaults to ''
 * @param mixed $limitfrom defaults to ''
 * @param mixed $limitnum defaults to ''
 * @param string $extrawheretest defaults to ''
 * @param array $whereorsortparams any paramter values used by $sort or $extrawheretest.
 * @return array
 */
function get_role_users($roleid, context $context, $parent = false, $fields = '',
        $sort = null, $all = true, $group = '',
        $limitfrom = '', $limitnum = '', $extrawheretest = '', $whereorsortparams = array()) {
    global $DB;

    if (empty($fields)) {
        $allnames = get_all_user_name_fields(true, 'u');
        $fields = 'u.id, u.confirmed, u.username, '. $allnames . ', ' .
                  'u.maildisplay, u.mailformat, u.maildigest, u.email, u.emailstop, u.city, '.
                  'u.country, u.picture, u.idnumber, u.department, u.institution, '.
                  'u.lang, u.timezone, u.lastaccess, u.mnethostid, r.name AS rolename, r.sortorder, '.
                  'r.shortname AS roleshortname, rn.name AS rolecoursealias';
    }

    $parentcontexts = '';
    if ($parent) {
        $parentcontexts = substr($context->path, 1); // kill leading slash
        $parentcontexts = str_replace('/', ',', $parentcontexts);
        if ($parentcontexts !== '') {
            $parentcontexts = ' OR ra.contextid IN ('.$parentcontexts.' )';
        }
    }

    if ($roleid) {
        list($rids, $params) = $DB->get_in_or_equal($roleid, SQL_PARAMS_NAMED, 'r');
        $roleselect = "AND ra.roleid $rids";
    } else {
        $params = array();
        $roleselect = '';
    }

    if ($coursecontext = $context->get_course_context(false)) {
        $params['coursecontext'] = $coursecontext->id;
    } else {
        $params['coursecontext'] = 0;
    }

    if ($group) {
        $groupjoin   = "JOIN {groups_members} gm ON gm.userid = u.id";
        $groupselect = " AND gm.groupid = :groupid ";
        $params['groupid'] = $group;
    } else {
        $groupjoin   = '';
        $groupselect = '';
    }

    $params['contextid'] = $context->id;

    if ($extrawheretest) {
        $extrawheretest = ' AND ' . $extrawheretest;
    }

    if ($whereorsortparams) {
        $params = array_merge($params, $whereorsortparams);
    }

    if (!$sort) {
        list($sort, $sortparams) = users_order_by_sql('u');
        $params = array_merge($params, $sortparams);
    }

    if ($all === null) {
        // Previously null was used to indicate that parameter was not used.
        $all = true;
    }
    if (!$all and $coursecontext) {
        // Do not use get_enrolled_sql() here for performance reasons.
        $ejoin = "JOIN {user_enrolments} ue ON ue.userid = u.id
                  JOIN {enrol} e ON (e.id = ue.enrolid AND e.courseid = :ecourseid)";
        $params['ecourseid'] = $coursecontext->instanceid;
    } else {
        $ejoin = "";
    }

    $sql = "SELECT DISTINCT $fields, ra.roleid
              FROM {role_assignments} ra
              JOIN {user} u ON u.id = ra.userid
              JOIN {role} r ON ra.roleid = r.id
            $ejoin
         LEFT JOIN {role_names} rn ON (rn.contextid = :coursecontext AND rn.roleid = r.id)
        $groupjoin
             WHERE (ra.contextid = :contextid $parentcontexts)
                   $roleselect
//.........这里部分代码省略.........
开发者ID:rwijaya,项目名称:moodle,代码行数:101,代码来源:accesslib.php


示例14: tempuser_to_user

 protected static function tempuser_to_user($tempuser)
 {
     $ret = (object) array('id' => $tempuser->studentid, 'firstname' => $tempuser->fullname, 'email' => $tempuser->email, 'username' => '', 'enrolmentstatus' => 0, 'enrolmentstart' => 0, 'enrolmentend' => 0, 'picture' => 0, 'type' => 'temporary');
     foreach (get_all_user_name_fields() as $namefield) {
         if (!isset($ret->{$namefield})) {
             $ret->{$namefield} = '';
         }
     }
     return $ret;
 }
开发者ID:webcursosuai,项目名称:moodle-mod_attendance,代码行数:10,代码来源:locallib.php


示例15: forum_get_recent_mod_activity

/**
 * Returns all forum posts since a given time in specified forum.
 *
 * @todo Document this functions args
 * @global object
 * @global object
 * @global object
 * @global object
 */
function forum_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid = 0, $groupid = 0)
{
    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];
    $params = array($timestart, $cm->instance);
    if ($userid) {
        $userselect = "AND u.id = ?";
        $params[] = $userid;
    } else {
        $userselect = "";
    }
    if ($groupid) {
        $groupselect = "AND d.groupid = ?";
        $params[] = $groupid;
    } else {
        $groupselect = "";
    }
    $allnames = get_all_user_name_fields(true, 'u');
    if (!($posts = $DB->get_records_sql("SELECT p.*, f.type AS forumtype, d.forum, d.groupid,\n                                              d.timestart, d.timeend, d.userid AS duserid,\n                                              {$allnames}, u.email, u.picture, u.imagealt, u.email\n                                         FROM {forum_posts} p\n                                              JOIN {forum_discussions} d ON d.id = p.discussion\n                                              JOIN {forum} f             ON f.id = d.forum\n                                              JOIN {user} u              ON u.id = p.userid\n                                        WHERE p.created > ? AND f.id = ?\n                                              {$userselect} {$groupselect}\n                                     ORDER BY p.id ASC", $params))) {
        // order by initial posting date
        return;
    }
    $groupmode = groups_get_activity_groupmode($cm, $course);
    $cm_context = context_module::instance($cm->id);
    $viewhiddentimed = has_capability('mod/forum:viewhiddentimedposts', $cm_context);
    $accessallgroups = has_capability('moodle/site:accessallgroups', $cm_context);
    $printposts = array();
    foreach ($posts as $post) {
        if (!empty($CFG->forum_enabletimedposts) and $USER->id != $post->duserid and ($post->timestart > 0 and $post->timestart > time() or $post->timeend > 0 and $post->timeend < time())) {
            if (!$viewhiddentimed) {
                continue;
            }
        }
        if ($groupmode) {
            if ($post->groupid == -1 or $groupmode == VISIBLEGROUPS or $accessallgroups) {
                // oki (Open discussions have groupid -1)
            } else {
                // separate mode
                if (isguestuser()) {
                    // shortcut
                    continue;
                }
                if (!in_array($post->groupid, $modinfo->get_groups($cm->groupingid))) {
                    continue;
                }
            }
        }
        $printposts[] = $post;
    }
    if (!$printposts) {
        return;
    }
    $aname = format_string($cm->name, true);
    foreach ($printposts as $post) {
        $tmpactivity = new stdClass();
        $tmpactivity->type = 'forum';
        $tmpactivity->cmid = $cm->id;
        $tmpactivity->name = $aname;
        $tmpactivity->sectionnum = $cm->sectionnum;
        $tmpactivity->timestamp = $post->modified;
        $tmpactivity->content = new stdClass();
        $tmpactivity->content->id = $post->id;
        $tmpactivity->content->discussion = $post->discussion;
        $tmpactivity->content->subject = format_string($post->subject);
        $tmpactivity->content->parent = $post->parent;
        $tmpactivity->user = new stdClass();
        $additionalfields = array('id' => 'userid', 'picture', 'imagealt', 'email');
        $additionalfields = explode(',', user_picture::fields());
        $tmpactivity->user = username_load_fields_from_object($tmpactivity->user, $post, null, $additionalfields);
        $tmpactivity->user->id = $post->userid;
        $activities[$index++] = $tmpactivity;
    }
    return;
}
开发者ID:abhilash1994,项目名称:moodle,代码行数:89,代码来源:lib.php


示例16: get_string

}
//UAIOPEN - tiene los permisos necesarios para ver todos los grupos
if (has_capability('moodle/site:accessallgroups', $context)) {
    echo '<p><input type="submit" name="act_showautocreategroupsform" id="showautocreategroupsform" value="' . get_string('autocreategroups', 'group') . '" /></p>' . "\n";
    echo '<p><input type="submit" name="act_showimportgroups" id="showimportgroups" value="' . get_string('importgroups', 'core_group') . '" /></p>' . "\n";
}
echo '</td>' . "\n";
echo '<td>' . "\n";
echo '<p><label for="members"><span id="memberslabel">' . get_string('membersofselectedgroup', 'group') . ' </span><span id="thegroup">' . $selectedname . '</span></label></p>' . "\n";
//NOTE: the SELECT was, multiple="multiple" name="user[]" - not used and breaks onclick.
echo '<select name="user" id="members" size="15" class="select"' . "\n";
echo ' onclick="window.status=this.options[this.selectedIndex].title;" onmouseout="window.status=\'\';">' . "\n";
$member_names = array();
$atleastonemember = false;
if ($singlegroup) {
    if ($groupmemberroles = groups_get_members_by_role($groupids[0], $courseid, 'u.id, ' . get_all_user_name_fields(true, 'u'))) {
        foreach ($groupmemberroles as $roleid => $roledata) {
            echo '<optgroup label="' . s($roledata->name) . '">';
            foreach ($roledata->users as $member) {
                echo '<option value="' . $member->id . '">' . fullname($member, true) . '</option>';
                $atleastonemember = true;
            }
            echo '</optgroup>';
        }
    }
}
if (!$atleastonemember) {
    // Print an empty option to avoid the XHTML error of having an empty select element
    echo '<option>&nbsp;</option>';
}
echo '</select>' . "\n";
开发者ID:edmiranda,项目名称:group,代码行数:31,代码来源:index.php


示例17: help_desk

$PAGE->navbar->add(get_string('pluginname', 'local_help_desk'));
$PAGE->navbar->add(get_string('accounts', 'local_help_desk'));
$PAGE->set_heading($SITE->fullname);
$renderer = $PAGE->get_renderer('local_help_desk');
$lib_help_desk = new help_desk();
$hierarchy = new hierarchy();
$ufiltering = new user_filtering_accounts();
//Tab tree (current tab)
$tab = 'accounts';
$serialkey_form = new accounts_serialkey_form(NULL, array('skid' => $skid));
echo $OUTPUT->header();
$lib_help_desk->createtabview($tab);
//Tab tree
$extracolumns = get_extra_user_fields($systemcontext);
$ufiltering = new user_filtering_accounts();
$allusernamefields = get_all_user_name_fields(false, null, null, null, true);
$columns = array_merge($allusernamefields, $extracolumns, array('city', 'country', 'lastaccess'));
foreach ($columns as $column) {
    $string[$column] = get_user_field_name($column);
    if ($sort != $column) {
        $columnicon = "";
        if ($column == "lastaccess") {
            $columndir = "DESC";
        } else {
            $columndir = "ASC";
        }
    } else {
        $columndir = $dir == "ASC" ? "DESC" : "ASC";
        if ($column == "lastaccess") {
            $columnicon = $dir == "ASC" ? "sort_desc" : "sort_asc";
        } else {
开发者ID:harshasunny,项目名称:alltasks,代码行数:31,代码来源:accounts.php


示例18: test_get_all_user_name_fields

 public function test_get_all_user_name_fields()
 {
     $this->resetAfterTest();
     // Additional names in an array.
     $testarray = array('firstnamephonetic' => 'firstnamephonetic', 'lastnamephonetic' => 'lastnamephonetic', 'middlename' => 'middlename', 'alternatename' => 'alternatename', 'firstname' => 'firstname', 'lastname' => 'lastname');
     $this->assertEquals($testarray, get_all_user_name_fields());
     // Additional names as a string.
     $teststring = 'firstnamephonetic,lastnamephonetic,middlename,alternatename,firstname,lastname';
     $this->assertEquals($teststring, get_all_user_name_fields(true));
     // Additional names as a string with an alias.
     $teststring = 't.firstnamephonetic,t.lastnamephonetic,t.middlename,t.alternatename,t.firstname,t.lastname';
     $this->assertEquals($teststring, get_all_user_name_fields(true, 't'));
     // Additional name fields with a prefix - object.
     $testarray = array('firstnamephonetic' => 'authorfirstnamephonetic', 'lastnamephonetic' => 'authorlastnamephonetic', 'middlename' => 'authormiddlename', 'alternatename' => 'authoralternatename', 'firstname' => 'authorfirstname', 'lastname' => 'authorlastname');
     $this->assertEquals($testarray, get_all_user_name_fields(false, null, 'author'));
     // Additional name fields with an alias and a title - string.
     $teststring = 'u.firstnamephonetic AS authorfirstnamephonetic,u.lastnamephonetic AS authorlastnamephonetic,u.middlename AS authormiddlename,u.alternatename AS authoralternatename,u.firstname AS authorfirstname,u.lastname AS authorlastname';
     $this->assertEquals($teststring, get_all_user_name_fields(true, 'u', null, 'author'));
 }
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:19,代码来源:moodlelib_test.php


示例19: get_graders

 /**
  * Get a list of graders.
  *
  * @param int $courseid Id of course for which we need to fetch graders.
  *
  * @return array list of graders.
  */
 public static function get_graders($courseid)
 {
     global $DB;
     $ufields = get_all_user_name_fields(true, 'u');
     $sql = "SELECT u.id, {$ufields}\n                  FROM {user} u\n                  JOIN {grade_grades_history} ggh ON ggh.usermodified = u.id\n                  JOIN {grade_items} gi ON gi.id = ggh.itemid\n                 WHERE gi.courseid = :courseid\n              GROUP BY u.id, {$ufields}\n              ORDER BY u.lastname ASC, u.firstname ASC";
     $graders = $DB->get_records_sql($sql, array('courseid' => $courseid));
     $return = array(0 => get_string('allgraders', 'gradereport_history'));
     foreach ($graders as $grader) {
         $return[$grader->id] = fullname($grader);
     }
     return $return;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:helper.php


示例20: blog_rss_get_feed

/**
 * Generate any blog RSS feed via one function
 *
 * @param stdClass $context The context of the blog for which the feed it being generated
 * @param array    $args    An array of arguements needed to build the feed (contextid, token, componentname, type, id, tagid)
 */
function blog_rss_get_feed($context, $args)
{
    global $CFG, $SITE, $DB;
    if (empty($CFG->enableblogs)) {
        debugging('Blogging disabled on this site, RSS feeds are not available');
        return null;
    }
    if (empty($CFG->enablerssfeeds)) {
        debugging('Sorry, RSS feeds are disabled on this site');
        return '';
    }
    if ($CFG->bloglevel == BLOG_SITE_LEVEL) {
        if (isguestuser()) {
            debugging(get_string('nopermissiontoshow', 'error'));
            return '';
        }
    }
    $sitecontext = context_system::instance();
    if (!has_capability('moodle/blog:view', $sitecontext)) {
        return null;
    }
    $type = clean_param($args[3], PARAM_ALPHA);
    $id = clean_param($args[4], PARAM_INT);
    // Could be groupid / courseid  / userid  depending on $type.
    $tagid = 0;
    if ($args[5] != 'rss.xml') {
        $tagid = clean_param($args[5], PARAM_INT);
    } else {
        $tagid = 0;
    }
    $filename = blog_rss_file_name($type, $id, $tagid);
    if (file_exists($filename)) {
        if (filemtime($filename) + 3600 > time()) {
            return $filename;
            // It's already done so we return cached version.
        }
    }
    $courseid = $groupid = $userid = null;
    switch ($type) {
        case 'site':
            break;
        case 'course':
            $courseid = $id;
            break;
        case 'group':
            $groupid = $id;
            break;
        case 'user':
            $userid = $id;
            break;
    }
    // Get all the entries from the database.
    require_once $CFG->dirroot . '/blog/locallib.php';
    $blogheaders = blog_get_headers($courseid, $groupid, $userid, $tagid);
    $bloglisting = new blog_listing($blogheaders['filters']);
    $blogentries = $bloglisting->get_entries();
    // Now generate an array of RSS items.
    if ($blogentries) {
        $items = array();
        foreach ($blogentries as $blogentry) {
            $item = new stdClass();
            $item->author = fullname($DB->get_record('user', array('id' => $blogentry->userid)));
            // TODO: this is slow.
            $item->title = $blogentry->subject;
            $item->pubdate = $blogentry->lastmodified;
            $item->link = $CFG->wwwroot . '/blog/index.php?entryid=' . $blogentry->id;
            $summary = file_rewrite_pluginfile_urls($blogentry->summary, 'pluginfile.php', $sitecontext->id, 'blog', 'post', $blogentry->id);
            $item->description = format_text($summary, $blogentry->format);
            if ($blogtags = core_tag_tag::get_item_tags_array('core', 'post', $blogentry->id)) {
                $item->tags = $blogtags;
                $item->tagscheme = $CFG->wwwroot . '/tag';
            }
            $items[] = $item;
        }
        $articles = rss_add_items($items);
        // Change structure to XML.
    } else {
        $articles = '';
    }
    // Get header and footer information.
    switch ($type) {
        case 'user':
            $info = fullname($DB->get_record('user', array('id' => $id), get_all_user_name_fields(true)));
            break;
        case 'course':
            $info = $DB->get_field('course', 'fullname', array('id' => $id));
            $info = format_string($info, true, array('context' => context_course::instance($id)));
            break;
        case 'site':
            $info = format_string($SITE->fullname, true, array('context' => context_course::instance(SITEID)));
            break;
        case 'group':
            $group = groups_get_group($id);
            $info = $group->name;
//.........这里部分代码省略.........
开发者ID:EsdrasCaleb,项目名称:moodle,代码行数:101,代码来源:rsslib.php



注:本文中的get_all_user_name_fields函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_all_user_settings函数代码示例发布时间:2022-05-15
下一篇:
PHP get_all_subcategories函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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