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

PHP get_extra_user_fields函数代码示例

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

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



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

示例1: definition

 /**
  * Define the form - called by parent constructor
  */
 public function definition()
 {
     global $DB;
     $mform = $this->_form;
     $params = $this->_customdata;
     // Instance variable is used by the form validation function.
     $instance = $params['instance'];
     $this->instance = $instance;
     // Get the assignment class.
     $assign = $params['assign'];
     $userlist = $params['userlist'];
     $usercount = 0;
     $usershtml = '';
     $extrauserfields = get_extra_user_fields($assign->get_context());
     foreach ($userlist as $userid) {
         if ($usercount >= 5) {
             $usershtml .= get_string('moreusers', 'assign', count($userlist) - 5);
             break;
         }
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $usershtml .= $assign->get_renderer()->render(new assign_user_summary($user, $assign->get_course()->id, has_capability('moodle/site:viewfullnames', $assign->get_course_context()), $assign->is_blind_marking(), $assign->get_uniqueid_for_user($user->id), $extrauserfields, !$assign->is_active_user($userid)));
         $usercount += 1;
     }
     $userscount = count($userlist);
     $listusersmessage = get_string('grantextensionforusers', 'assign', $userscount);
     $mform->addElement('header', 'general', $listusersmessage);
     $mform->addElement('static', 'userslist', get_string('selectedusers', 'assign'), $usershtml);
     if ($instance->allowsubmissionsfromdate) {
         $mform->addElement('static', 'allowsubmissionsfromdate', get_string('allowsubmissionsfromdate', 'assign'), userdate($instance->allowsubmissionsfromdate));
     }
     $finaldate = 0;
     if ($instance->duedate) {
         $mform->addElement('static', 'duedate', get_string('duedate', 'assign'), userdate($instance->duedate));
         $finaldate = $instance->duedate;
     }
     if ($instance->cutoffdate) {
         $mform->addElement('static', 'cutoffdate', get_string('cutoffdate', 'assign'), userdate($instance->cutoffdate));
         $finaldate = $instance->cutoffdate;
     }
     $mform->addElement('date_time_selector', 'extensionduedate', get_string('extensionduedate', 'assign'), array('optional' => true));
     $mform->setDefault('extensionduedate', $finaldate);
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'userid');
     $mform->setType('userid', PARAM_INT);
     $mform->addElement('hidden', 'selectedusers');
     $mform->setType('selectedusers', PARAM_SEQUENCE);
     $mform->addElement('hidden', 'action', 'saveextension');
     $mform->setType('action', PARAM_ALPHA);
     $this->add_action_buttons(true, get_string('savechanges', 'assign'));
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:54,代码来源:extensionform.php


示例2: init

 /**
  * Initialises table
  */
 protected function init()
 {
     $tablecolumns = array('userpic', 'fullname');
     $tableheaders = array(get_string('userpic'), get_string('fullnameuser'));
     $extrafields = get_extra_user_fields($this->get_context());
     $ufields = user_picture::fields('u', $extrafields, $this->useridfield);
     $fields = 'c.id, c.timemodified as completed_timemodified, c.courseid, ' . $ufields;
     $from = '{feedback_completed} c ' . 'JOIN {user} u ON u.id = c.userid AND u.deleted = :notdeleted';
     $where = 'c.anonymous_response = :anon
             AND c.feedback = :instance';
     if ($this->feedbackstructure->get_courseid()) {
         $where .= ' AND c.courseid = :courseid';
     }
     if ($this->is_downloading()) {
         // When downloading data:
         // Remove 'userpic' from downloaded data.
         array_shift($tablecolumns);
         array_shift($tableheaders);
         // Add all identity fields as separate columns.
         foreach ($extrafields as $field) {
             $fields .= ", u.{$field}";
             $tablecolumns[] = $field;
             $tableheaders[] = get_user_field_name($field);
         }
     }
     if ($this->feedbackstructure->get_feedback()->course == SITEID && !$this->feedbackstructure->get_courseid()) {
         $tablecolumns[] = 'courseid';
         $tableheaders[] = get_string('course');
     }
     $tablecolumns[] = 'completed_timemodified';
     $tableheaders[] = get_string('date');
     $this->define_columns($tablecolumns);
     $this->define_headers($tableheaders);
     $this->sortable(true, 'lastname', SORT_ASC);
     $this->collapsible(true);
     $this->set_attribute('id', 'showentrytable');
     $params = array();
     $params['anon'] = FEEDBACK_ANONYMOUS_NO;
     $params['instance'] = $this->feedbackstructure->get_feedback()->id;
     $params['notdeleted'] = 0;
     $params['courseid'] = $this->feedbackstructure->get_courseid();
     $group = groups_get_activity_group($this->feedbackstructure->get_cm(), true);
     if ($group) {
         $where .= ' AND c.userid IN (SELECT g.userid FROM {groups_members} g WHERE g.groupid = :group)';
         $params['group'] = $group;
     }
     $this->set_sql($fields, $from, $where, $params);
     $this->set_count_sql("SELECT COUNT(c.id) FROM {$from} WHERE {$where}", $params);
 }
开发者ID:IFPBMoodle,项目名称:moodle,代码行数:52,代码来源:responses_table.php


示例3: configure_user_columns

 /**
  * Set the display options for the user-related columns in the table.
  * @param table_sql $table the table being constructed.
  */
 protected function configure_user_columns($table)
 {
     $table->column_suppress('picture');
     $table->column_suppress('fullname');
     $extrafields = get_extra_user_fields($this->context);
     foreach ($extrafields as $field) {
         $table->column_suppress($field);
     }
     $table->column_class('picture', 'picture');
     $table->column_class('lastname', 'bold');
     $table->column_class('firstname', 'bold');
     $table->column_class('fullname', 'bold');
 }
开发者ID:dg711,项目名称:moodle,代码行数:17,代码来源:attemptsreport.php


示例4: __construct

 /**
  * overridden constructor keeps a reference to the assignment class that is displaying this table
  *
  * @param assign $assignment The assignment class
  * @param int $perpage how many per page
  * @param string $filter The current filter
  * @param int $rowoffset For showing a subsequent page of results
  * @param bool $quickgrading Is this table wrapped in a quickgrading form?
  * @param string $downloadfilename
  */
 public function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgrading, $downloadfilename = null)
 {
     global $CFG, $PAGE, $DB, $USER;
     parent::__construct('mod_assign_grading');
     $this->is_persistent(true);
     $this->assignment = $assignment;
     // Check permissions up front.
     $this->hasgrantextension = has_capability('mod/assign:grantextension', $this->assignment->get_context());
     $this->hasgrade = $this->assignment->can_grade();
     // Check if we have the elevated view capablities to see the blind details.
     $this->hasviewblind = has_capability('mod/assign:viewblinddetails', $this->assignment->get_context());
     foreach ($assignment->get_feedback_plugins() as $plugin) {
         if ($plugin->is_visible() && $plugin->is_enabled()) {
             foreach ($plugin->get_grading_batch_operations() as $action => $description) {
                 if (empty($this->plugingradingbatchoperations)) {
                     $this->plugingradingbatchoperations[$plugin->get_type()] = array();
                 }
                 $this->plugingradingbatchoperations[$plugin->get_type()][$action] = $description;
             }
         }
     }
     $this->perpage = $perpage;
     $this->quickgrading = $quickgrading && $this->hasgrade;
     $this->output = $PAGE->get_renderer('mod_assign');
     $urlparams = array('action' => 'grading', 'id' => $assignment->get_course_module()->id);
     $url = new moodle_url($CFG->wwwroot . '/mod/assign/view.php', $urlparams);
     $this->define_baseurl($url);
     // Do some business - then set the sql.
     $currentgroup = groups_get_activity_group($assignment->get_course_module(), true);
     if ($rowoffset) {
         $this->rownum = $rowoffset - 1;
     }
     $users = array_keys($assignment->list_participants($currentgroup, true));
     if (count($users) == 0) {
         // Insert a record that will never match to the sql is still valid.
         $users[] = -1;
     }
     $params = array();
     $params['assignmentid1'] = (int) $this->assignment->get_instance()->id;
     $params['assignmentid2'] = (int) $this->assignment->get_instance()->id;
     $params['assignmentid3'] = (int) $this->assignment->get_instance()->id;
     $extrauserfields = get_extra_user_fields($this->assignment->get_context());
     $fields = user_picture::fields('u', $extrauserfields) . ', ';
     $fields .= 'u.id as userid, ';
     $fields .= 's.status as status, ';
     $fields .= 's.id as submissionid, ';
     $fields .= 's.timecreated as firstsubmission, ';
     $fields .= 's.timemodified as timesubmitted, ';
     $fields .= 's.attemptnumber as attemptnumber, ';
     $fields .= 'g.id as gradeid, ';
     $fields .= 'g.grade as grade, ';
     $fields .= 'g.timemodified as timemarked, ';
     $fields .= 'g.timecreated as firstmarked, ';
     $fields .= 'uf.mailed as mailed, ';
     $fields .= 'uf.locked as locked, ';
     $fields .= 'uf.extensionduedate as extensionduedate, ';
     $fields .= 'uf.workflowstate as workflowstate, ';
     $fields .= 'uf.allocatedmarker as allocatedmarker ';
     $from = '{user} u
                      LEFT JOIN {assign_submission} s
                             ON u.id = s.userid
                            AND s.assignment = :assignmentid1
                            AND s.latest = 1
                      LEFT JOIN {assign_grades} g
                             ON u.id = g.userid
                            AND g.assignment = :assignmentid2 ';
     // For group submissions we don't immediately create an entry in the assign_submission table for each user,
     // instead the userid is set to 0. In this case we use a different query to retrieve the grade for the user.
     if ($this->assignment->get_instance()->teamsubmission) {
         $params['assignmentid4'] = (int) $this->assignment->get_instance()->id;
         $grademaxattempt = 'SELECT mxg.userid, MAX(mxg.attemptnumber) AS maxattempt
                               FROM {assign_grades} mxg
                              WHERE mxg.assignment = :assignmentid4
                           GROUP BY mxg.userid';
         $from .= 'LEFT JOIN (' . $grademaxattempt . ') gmx
                          ON u.id = gmx.userid
                         AND g.attemptnumber = gmx.maxattempt ';
     } else {
         $from .= 'AND g.attemptnumber = s.attemptnumber ';
     }
     $from .= 'LEFT JOIN {assign_user_flags} uf
                      ON u.id = uf.userid
                     AND uf.assignment = :assignmentid3';
     $userparams = array();
     $userindex = 0;
     list($userwhere, $userparams) = $DB->get_in_or_equal($users, SQL_PARAMS_NAMED, 'user');
     $where = 'u.id ' . $userwhere;
     $params = array_merge($params, $userparams);
     // The filters do not make sense when there are no submissions, so do not apply them.
     if ($this->assignment->is_any_submission_plugin_enabled()) {
//.........这里部分代码省略.........
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:101,代码来源:gradingtable.php


示例5: view_batch_markingallocation

 /**
  * Shows a form that allows the allocated marker for selected submissions to be changed.
  *
  * @param moodleform $mform Set to a grading batch operations form
  * @return string - the page to view after processing these actions
  */
 private function view_batch_markingallocation($mform)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/mod/assign/batchsetallocatedmarkerform.php';
     $o = '';
     $submitteddata = $mform->get_data();
     $users = $submitteddata->selectedusers;
     $userlist = explode(',', $users);
     $formparams = array('cm' => $this->get_course_module()->id, 'users' => $userlist, 'context' => $this->get_context());
     $usershtml = '';
     $usercount = 0;
     $extrauserfields = get_extra_user_fields($this->get_context());
     foreach ($userlist as $userid) {
         if ($usercount >= 5) {
             $usershtml .= get_string('moreusers', 'assign', count($userlist) - 5);
             break;
         }
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $usershtml .= $this->get_renderer()->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context()), $this->is_blind_marking(), $this->get_uniqueid_for_user($user->id), $extrauserfields, !$this->is_active_user($userid)));
         $usercount += 1;
     }
     $formparams['usershtml'] = $usershtml;
     $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade');
     $markerlist = array();
     foreach ($markers as $marker) {
         $markerlist[$marker->id] = fullname($marker);
     }
     $formparams['markers'] = $markerlist;
     $mform = new mod_assign_batch_set_allocatedmarker_form(null, $formparams);
     $o .= $this->get_renderer()->header();
     $o .= $this->get_renderer()->render(new assign_form('setworkflowstate', $mform));
     $o .= $this->view_footer();
     $this->add_to_log('view batch set marker allocation', get_string('viewbatchmarkingallocation', 'assign'));
     return $o;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:41,代码来源:locallib.php


示例6: user_get_user_details

/**
 *
 * Give user record from mdl_user, build an array conntains
 * all user details
 *
 * Warning: description file urls are 'webservice/pluginfile.php' is use.
 *          it can be changed with $CFG->moodlewstextformatlinkstoimagesfile
 *
 * @param stdClass $user user record from mdl_user
 * @param stdClass $context context object
 * @param stdClass $course moodle course
 * @param array $userfields required fields
 * @return array|null
 */
function user_get_user_details($user, $course = null, array $userfields = array())
{
    global $USER, $DB, $CFG;
    require_once $CFG->dirroot . "/user/profile/lib.php";
    //custom field library
    require_once $CFG->dirroot . "/lib/filelib.php";
    // file handling on description and friends
    $defaultfields = user_get_default_fields();
    if (empty($userfields)) {
        $userfields = $defaultfields;
    }
    foreach ($userfields as $thefield) {
        if (!in_array($thefield, $defaultfields)) {
            throw new moodle_exception('invaliduserfield', 'error', '', $thefield);
        }
    }
    // Make sure id and fullname are included
    if (!in_array('id', $userfields)) {
        $userfields[] = 'id';
    }
    if (!in_array('fullname', $userfields)) {
        $userfields[] = 'fullname';
    }
    if (!empty($course)) {
        $context = context_course::instance($course->id);
        $usercontext = context_user::instance($user->id);
        $canviewdetailscap = has_capability('moodle/user:viewdetails', $context) || has_capability('moodle/user:viewdetails', $usercontext);
    } else {
        $context = context_user::instance($user->id);
        $usercontext = $context;
        $canviewdetailscap = has_capability('moodle/user:viewdetails', $usercontext);
    }
    $currentuser = $user->id == $USER->id;
    $isadmin = is_siteadmin($USER);
    $showuseridentityfields = get_extra_user_fields($context);
    if (!empty($course)) {
        $canviewhiddenuserfields = has_capability('moodle/course:viewhiddenuserfields', $context);
    } else {
        $canviewhiddenuserfields = has_capability('moodle/user:viewhiddendetails', $context);
    }
    $canviewfullnames = has_capability('moodle/site:viewfullnames', $context);
    if (!empty($course)) {
        $canviewuseremail = has_capability('moodle/course:useremail', $context);
    } else {
        $canviewuseremail = false;
    }
    $cannotviewdescription = !empty($CFG->profilesforenrolledusersonly) && !$currentuser && !$DB->record_exists('role_assignments', array('userid' => $user->id));
    if (!empty($course)) {
        $canaccessallgroups = has_capability('moodle/site:accessallgroups', $context);
    } else {
        $canaccessallgroups = false;
    }
    if (!$currentuser && !$canviewdetailscap && !has_coursecontact_role($user->id)) {
        // skip this user details
        return null;
    }
    $userdetails = array();
    $userdetails['id'] = $user->id;
    if (($isadmin or $currentuser) and in_array('username', $userfields)) {
        $userdetails['username'] = $user->username;
    }
    if ($isadmin or $canviewfullnames) {
        if (in_array('firstname', $userfields)) {
            $userdetails['firstname'] = $user->firstname;
        }
        if (in_array('lastname', $userfields)) {
            $userdetails['lastname'] = $user->lastname;
        }
    }
    $userdetails['fullname'] = fullname($user);
    if (in_array('customfields', $userfields)) {
        $fields = $DB->get_recordset_sql("SELECT f.*\n                                            FROM {user_info_field} f\n                                            JOIN {user_info_category} c\n                                                 ON f.categoryid=c.id\n                                        ORDER BY c.sortorder ASC, f.sortorder ASC");
        $userdetails['customfields'] = array();
        foreach ($fields as $field) {
            require_once $CFG->dirroot . '/user/profile/field/' . $field->datatype . '/field.class.php';
            $newfield = 'profile_field_' . $field->datatype;
            $formfield = new $newfield($field->id, $user->id);
            if ($formfield->is_visible() and !$formfield->is_empty()) {
                $userdetails['customfields'][] = array('name' => $formfield->field->name, 'value' => $formfield->data, 'type' => $field->datatype, 'shortname' => $formfield->field->shortname);
            }
        }
        $fields->close();
        // unset customfields if it's empty
        if (empty($userdetails['customfields'])) {
            unset($userdetails['customfields']);
        }
//.........这里部分代码省略.........
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:101,代码来源:lib.php


示例7: view_batch_markingallocation

 /**
  * Shows a form that allows the allocated marker for selected submissions to be changed.
  *
  * @param moodleform $mform Set to a grading batch operations form
  * @return string - the page to view after processing these actions
  */
 public function view_batch_markingallocation($mform)
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/mod/assign/batchsetallocatedmarkerform.php';
     $o = '';
     $submitteddata = $mform->get_data();
     $users = $submitteddata->selectedusers;
     $userlist = explode(',', $users);
     $formdata = array('id' => $this->get_course_module()->id, 'selectedusers' => $users);
     $usershtml = '';
     $usercount = 0;
     $extrauserfields = get_extra_user_fields($this->get_context());
     foreach ($userlist as $userid) {
         if ($usercount >= 5) {
             $usershtml .= get_string('moreusers', 'assign', count($userlist) - 5);
             break;
         }
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $usershtml .= $this->get_renderer()->render(new assign_user_summary($user, $this->get_course()->id, has_capability('moodle/site:viewfullnames', $this->get_course_context()), $this->is_blind_marking(), $this->get_uniqueid_for_user($user->id), $extrauserfields, !$this->is_active_user($userid)));
         $usercount += 1;
     }
     $formparams = array('userscount' => count($userlist), 'usershtml' => $usershtml);
     list($sort, $params) = users_order_by_sql();
     $markers = get_users_by_capability($this->get_context(), 'mod/assign:grade', '', $sort);
     $markerlist = array();
     foreach ($markers as $marker) {
         $markerlist[$marker->id] = fullname($marker);
     }
     $formparams['markers'] = $markerlist;
     $mform = new mod_assign_batch_set_allocatedmarker_form(null, $formparams);
     $mform->set_data($formdata);
     // Initialises the hidden elements.
     $header = new assign_header($this->get_instance(), $this->get_context(), $this->show_intro(), $this->get_course_module()->id, get_string('setmarkingallocation', 'assign'));
     $o .= $this->get_renderer()->render($header);
     $o .= $this->get_renderer()->render(new assign_form('setworkflowstate', $mform));
     $o .= $this->view_footer();
     \mod_assign\event\batch_set_marker_allocation_viewed::create_from_assign($this)->trigger();
     return $o;
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:45,代码来源:locallib.php


示例8: get_users_sql_and_params

 /**
  * Get sql and params to use to get list of users.
  *
  * @param \context $context Context of the page where the results would be shown.
  * @param string $search the text to search for (empty string = find all).
  * @param bool $count setting this to true, returns an sql to get count only instead of the complete data records.
  *
  * @return array sql and params list
  */
 protected static function get_users_sql_and_params($context, $search = '', $count = false)
 {
     // Fields we need from the user table.
     $extrafields = get_extra_user_fields($context);
     $params = array();
     if (!empty($search)) {
         list($filtersql, $params) = users_search_sql($search, 'u', true, $extrafields);
         $filtersql .= ' AND ';
     } else {
         $filtersql = '';
     }
     $ufields = \user_picture::fields('u', $extrafields) . ',u.username';
     if ($count) {
         $select = "SELECT COUNT(DISTINCT u.id) ";
         $orderby = "";
     } else {
         $select = "SELECT DISTINCT {$ufields} ";
         $orderby = " ORDER BY u.lastname ASC, u.firstname ASC";
     }
     $sql = "{$select}\n                 FROM {user} u\n                 JOIN {grade_grades_history} ggh ON u.id = ggh.userid\n                 JOIN {grade_items} gi ON gi.id = ggh.itemid\n                WHERE {$filtersql} gi.courseid = :courseid";
     $sql .= $orderby;
     $params['courseid'] = $context->instanceid;
     return array($sql, $params);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:33,代码来源:helper.php


示例9: get_users_for_display

 /**
  * Gets an array of users for display, this includes minimal user information
  * as well as minimal information on the users roles, groups, and enrolments.
  *
  * @param core_enrol_renderer $renderer
  * @param moodle_url $pageurl
  * @param int $sort
  * @param string $direction ASC or DESC
  * @param int $page
  * @param int $perpage
  * @return array
  */
 public function get_users_for_display(course_enrolment_manager $manager, $sort, $direction, $page, $perpage)
 {
     $pageurl = $manager->get_moodlepage()->url;
     $users = $this->get_users($sort, $direction, $page, $perpage);
     $now = time();
     $straddgroup = get_string('addgroup', 'group');
     $strunenrol = get_string('unenrol', 'enrol');
     $stredit = get_string('edit');
     $allroles = $this->get_all_roles();
     $assignable = $this->get_assignable_roles();
     $allgroups = $this->get_all_groups();
     $context = $this->get_context();
     $canmanagegroups = has_capability('moodle/course:managegroups', $context);
     $url = new moodle_url($pageurl, $this->get_url_params());
     $extrafields = get_extra_user_fields($context);
     $enabledplugins = $this->get_enrolment_plugins(true);
     $userdetails = array();
     foreach ($users as $user) {
         $details = $this->prepare_user_for_display($user, $extrafields, $now);
         // Roles
         $details['roles'] = array();
         foreach ($this->get_user_roles($user->id) as $rid => $rassignable) {
             $unchangeable = !$rassignable;
             if (!is_siteadmin() and !isset($assignable[$rid])) {
                 $unchangeable = true;
             }
             $details['roles'][$rid] = array('text' => $allroles[$rid]->localname, 'unchangeable' => $unchangeable);
         }
         // Users
         $usergroups = $this->get_user_groups($user->id);
         $details['groups'] = array();
         foreach ($usergroups as $gid => $unused) {
             $details['groups'][$gid] = $allgroups[$gid]->name;
         }
         // Enrolments
         $details['enrolments'] = array();
         foreach ($this->get_user_enrolments($user->id) as $ue) {
             if (!isset($enabledplugins[$ue->enrolmentinstance->enrol])) {
                 $details['enrolments'][$ue->id] = array('text' => $ue->enrolmentinstancename, 'period' => null, 'dimmed' => true, 'actions' => array());
                 continue;
             } else {
                 if ($ue->timestart and $ue->timeend) {
                     $period = get_string('periodstartend', 'enrol', array('start' => userdate($ue->timestart), 'end' => userdate($ue->timeend)));
                     $periodoutside = $ue->timestart && $ue->timeend && ($now < $ue->timestart || $now > $ue->timeend);
                 } else {
                     if ($ue->timestart) {
                         $period = get_string('periodstart', 'enrol', userdate($ue->timestart));
                         $periodoutside = $ue->timestart && $now < $ue->timestart;
                     } else {
                         if ($ue->timeend) {
                             $period = get_string('periodend', 'enrol', userdate($ue->timeend));
                             $periodoutside = $ue->timeend && $now > $ue->timeend;
                         } else {
                             // If there is no start or end show when user was enrolled.
                             $period = get_string('periodnone', 'enrol', userdate($ue->timecreated));
                             $periodoutside = false;
                         }
                     }
                 }
             }
             $details['enrolments'][$ue->id] = array('text' => $ue->enrolmentinstancename, 'period' => $period, 'dimmed' => $periodoutside or $ue->status != ENROL_USER_ACTIVE or $ue->enrolmentinstance->status != ENROL_INSTANCE_ENABLED, 'actions' => $ue->enrolmentplugin->get_user_enrolment_actions($manager, $ue));
         }
         $userdetails[$user->id] = $details;
     }
     return $userdetails;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:78,代码来源:locallib.php


示例10: get_left_rows

 /**
  * Builds and returns the rows that will make up the left part of the grader report
  * This consists of student names and icons, links to user reports and id numbers, as well
  * as header cells for these columns. It also includes the fillers required for the
  * categories displayed on the right side of the report.
  * @param boolean $displayaverages whether to display average rows in the table
  * @return array Array of html_table_row objects
  */
 public function get_left_rows($displayaverages)
 {
     global $CFG, $USER, $OUTPUT;
     $rows = array();
     $showuserimage = $this->get_pref('showuserimage');
     $strfeedback = $this->get_lang_string("feedback");
     $strgrade = $this->get_lang_string('grade');
     $extrafields = get_extra_user_fields($this->context);
     $arrows = $this->get_sort_arrows($extrafields);
     $colspan = 1;
     if (has_capability('gradereport/' . $CFG->grade_profilereport . ':view', $this->context)) {
         $colspan++;
     }
     $colspan += count($extrafields);
     $levels = count($this->gtree->levels) - 1;
     for ($i = 0; $i < $levels; $i++) {
         $fillercell = new html_table_cell();
         $fillercell->attributes['class'] = 'fixedcolumn cell topleft';
         $fillercell->text = ' ';
         $fillercell->colspan = $colspan;
         $row = new html_table_row(array($fillercell));
         $rows[] = $row;
     }
     $headerrow = new html_table_row();
     $headerrow->attributes['class'] = 'heading';
     $studentheader = new html_table_cell();
     $studentheader->attributes['class'] = 'header';
     $studentheader->scope = 'col';
     $studentheader->header = true;
     $studentheader->id = 'studentheader';
     if (has_capability('gradereport/' . $CFG->grade_profilereport . ':view', $this->context)) {
         $studentheader->colspan = 2;
     }
     $studentheader->text = $arrows['studentname'];
     $headerrow->cells[] = $studentheader;
     foreach ($extrafields as $field) {
         $fieldheader = new html_table_cell();
         $fieldheader->attributes['class'] = 'header userfield user' . $field;
         $fieldheader->scope = 'col';
         $fieldheader->header = true;
         $fieldheader->text = $arrows[$field];
         $headerrow->cells[] = $fieldheader;
     }
     $rows[] = $headerrow;
     $rows = $this->get_left_icons_row($rows, $colspan);
     $rowclasses = array('even', 'odd');
     $suspendedstring = null;
     foreach ($this->users as $userid => $user) {
         $userrow = new html_table_row();
         $userrow->id = 'fixed_user_' . $userid;
         $userrow->attributes['class'] = 'r' . $this->rowcount++ . ' ' . $rowclasses[$this->rowcount % 2];
         $usercell = new html_table_cell();
         $usercell->attributes['class'] = 'user';
         $usercell->header = true;
         $usercell->scope = 'row';
         if ($showuserimage) {
             $usercell->text = $OUTPUT->user_picture($user);
         }
         $usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user));
         if (!empty($user->suspendedenrolment)) {
             $usercell->attributes['class'] .= ' usersuspended';
             //may be lots of suspended users so only get the string once
             if (empty($suspendedstring)) {
                 $suspendedstring = get_string('userenrolmentsuspended', 'grades');
             }
             $usercell->text .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/enrolmentsuspended'), 'title' => $suspendedstring, 'alt' => $suspendedstring, 'class' => 'usersuspendedicon'));
         }
         $userrow->cells[] = $usercell;
         if (has_capability('gradereport/' . $CFG->grade_profilereport . ':view', $this->context)) {
             $userreportcell = new html_table_cell();
             $userreportcell->attributes['class'] = 'userreport';
             $userreportcell->header = true;
             $a = new stdClass();
             $a->user = fullname($user);
             $strgradesforuser = get_string('gradesforuser', 'grades', $a);
             $url = new moodle_url('/grade/report/' . $CFG->grade_profilereport . '/index.php', array('userid' => $user->id, 'id' => $this->course->id));
             $userreportcell->text = $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser));
             $userrow->cells[] = $userreportcell;
         }
         foreach ($extrafields as $field) {
             $fieldcell = new html_table_cell();
             $fieldcell->attributes['class'] = 'header userfield user' . $field;
             $fieldcell->header = true;
             $fieldcell->scope = 'row';
             $fieldcell->text = $user->{$field};
             $userrow->cells[] = $fieldcell;
         }
         $rows[] = $userrow;
     }
     $rows = $this->get_left_range_row($rows, $colspan);
     if ($displayaverages) {
         $rows = $this->get_left_avg_row($rows, $colspan, true);
//.........这里部分代码省略.........
开发者ID:educacionbe,项目名称:cursos,代码行数:101,代码来源:lib.php


示例11: booking_subscribed_teachers

/**
 * Returns list of user objects that are subscribed to this forum
 *
 * @global object
 * @global object
 * @param object $course the course
 * @param forum $forum the forum
 * @param integer $groupid group id, or 0 for all.
 * @param object $context the forum context, to save re-fetching it where possible.
 * @param string $fields requested user fields (with "u." table prefix)
 * @return array list of users.
 */
function booking_subscribed_teachers($course, $optionid, $id, $groupid = 0, $context = null, $fields = null)
{
    global $CFG, $DB;
    if (empty($context)) {
        $cm = get_coursemodule_from_id('booking', $id);
        $context = context_module::instance($cm->id);
    }
    $extrauserfields = get_extra_user_fields($context);
    $allnames = user_picture::fields('u', $extrauserfields);
    if (empty($fields)) {
        $fields = "u.id,\n        u.username,\n        {$allnames},\n        u.maildisplay,\n        u.mailformat,\n        u.maildigest,\n        u.imagealt,\n        u.email,\n        u.emailstop,\n        u.city,\n        u.country,\n        u.lastaccess,\n        u.lastlogin,\n        u.picture,\n        u.timezone,\n        u.theme,\n        u.lang,\n        u.trackforums,\n        u.mnethostid";
    }
    // only active enrolled users or everybody on the frontpage
    list($esql, $params) = get_enrolled_sql($context, '', $groupid, true);
    $params['optionid'] = $optionid;
    $results = $DB->get_records_sql("SELECT {$fields}\n\t\tFROM {user} u\n\t\tJOIN ({$esql}) je ON je.id = u.id\n\t\tJOIN {booking_teachers} s ON s.userid = u.id\n\t\tWHERE s.optionid = :optionid\n\t\tORDER BY u.email ASC", $params);
    // Guest user should never be subscribed to a forum.
    unset($results[$CFG->siteguest]);
    return $results;
}
开发者ID:375michael40veit,项目名称:moodle-mod_booking,代码行数:32,代码来源:lib.php


示例12: test_get_extra_user_fields

    public function test_get_extra_user_fields() {
        global $CFG, $USER, $DB;
        $oldshowuseridentity = $CFG->showuseridentity;

        $olduser = $USER;
        $USER = $DB->get_record('user', array('id'=>2)); //admin

        // It would be really nice if there were a way to 'mock' has_capability
        // checks (either to return true or false) but as there is not, this
        // test doesn't test the capability check. Presumably, anyone running
        // unit tests will have the capability.
        $context = context_system::instance();

        // No fields
        $CFG->showuseridentity = '';
        $this->assertEquals(array(), get_extra_user_fields($context));

        // One field
        $CFG->showuseridentity = 'frog';
        $this->assertEquals(array('frog'), get_extra_user_fields($context));

        // Two fields
        $CFG->showuseridentity = 'frog,zombie';
        $this->assertEquals(array('frog', 'zombie'), get_extra_user_fields($context));

        // No fields, except
        $CFG->showuseridentity = '';
        $this->assertEquals(array(), get_extra_user_fields($context, array('frog')));

        // One field
        $CFG->showuseridentity = 'frog';
        $this->assertEquals(array(), get_extra_user_fields($context, array('frog')));

        // Two fields
        $CFG->showuseridentity = 'frog,zombie';
        $this->assertEquals(array('zombie'), get_extra_user_fields($context, array('frog')));

        // As long as this test passes, the value will be set back. This is only
        // in-memory anyhow
        $CFG->showuseridentity = $oldshowuseridentity;

        $USER = $olduser;
    }
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:43,代码来源:moodlelib_test.php


示例13: generate_treeview

    /**
     * Generate treeview markup
     *
     * @access  public
     * @return  string  $html Markup for treeview
     */
    public function generate_treeview() {
        global $CFG;

        // Maximum number of items to load (at any one level)
        // before giving up and suggesting search instead
        $maxitems = DIALOG_MAXITEMS;

        // Check if user has capability to view emails.
        $canviewemail = in_array('email', get_extra_user_fields(context_system::instance()));

        $html = '';

        //$html .= !$this->show_treeview_only ? '<div class="treeview-wrapper dialog-nobind" id="d" style="height:auto;">' : '';
        $show_root = $this->_show_treeview_root();
        $html .= $show_root ? '<ul class="treeview filetree picker">' : '';

        if (is_array($this->items) && !empty($this->items)) {

            $total = count($this->items);
            $count = 0;

            if ($total > $maxitems) {
                $html .= '<li class="last"><span class="empty">';
                $html .= get_string('error:morethanxitemsatthislevel', 'local_core', $maxitems);
                $html .= ' <a href="#search-tab" onclick="$(\'#dialog-tabs\').tabs(\'select\', 1);return false;">';
                $html .= get_string('trysearchinginstead', 'local_core');
                $html .= '</a>';
                $html .= '</span></li>'.PHP_EOL;
            }
            else {
                // Loop through elements
                foreach ($this->items as $element) {
                    ++$count;

                    // Initialise class vars
                    $li_class = '';
                    $div_class = '';
                    $span_class = '';

                    // If last element
                    if ($count == $total) {
                        $li_class .= ' last';
                    }

                    // If element has children
                    if (array_key_exists($element->id, $this->parent_items)) {
                        $li_class .= ' expandable';
                        $div_class .= ' hitarea expandable-hitarea';
                        $span_class .= ' folder';

                        if ($count == $total) {
                            $li_class .= ' lastExpandable';
                            $div_class .= ' lastExpandable-hitarea';
                        }
                    }

                    // Make disabled elements non-draggable and greyed out
                    if (array_key_exists($element->id, $this->disabled_items)){
                        $span_class .= ' unclickable';
                    } else {
                        $span_class .= ' clickable';
                    }

                    $html .= '<li class="'.trim($li_class).'" id="item_list_'.$element->id.'">';
                    $html .= '<div class="'.trim($div_class).'"></div>';
                    $html .= '<span id="item_'.$element->id.'" class="'.trim($span_class).'">';

                    // Grab item display name
                    if (isset($element->fullname)) {
                        if (isset($element->email) && $canviewemail) {
                            $displayname = get_string('assignindividual', 'local_program', $element);
                        } else {
                            $displayname = $element->fullname;
                        }
                    } elseif (isset($element->name)) {
                        $displayname = $element->name;
                    } else {
                        $displayname = '';
                    }

                    $html .= '<a href="#"';
                    if (!empty($element->hover)) {
                        $html .= ' title="'.format_string($element->hover).'"';
                    }
                    $html .= '>';
                    $html .= format_string($displayname);
                    $html .= '</a>';
                    //$html .= '<span class="deletebutton">delete</span>';

                    $html .= '</span>';

                    if ($div_class !== '') {
                        $html .= '<ul style="display: none;"></ul>';
                    }
//.........这里部分代码省略.........
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:101,代码来源:dialog_content.class.php


示例14: view_batch_upload_files

 /**
  * Upload files and send them to multiple users.
  *
  * @param array $users - An array of user ids
  * @return string - The response html
  */
 public function view_batch_upload_files($users)
 {
     global $CFG, $DB, $USER;
     require_capability('mod/sepl:grade', $this->seplment->get_context());
     require_once $CFG->dirroot . '/mod/sepl/feedback/file/batchuploadfilesform.php';
     require_once $CFG->dirroot . '/mod/sepl/renderable.php';
     $formparams = array('cm' => $this->seplment->get_course_module()->id, 'users' => $users, 'context' => $this->seplment->get_context());
     $usershtml = '';
     $usercount = 0;
     foreach ($users as $userid) {
         if ($usercount >= ASSIGNFEEDBACK_FILE_MAXSUMMARYUSERS) {
             $moreuserscount = count($users) - ASSIGNFEEDBACK_FILE_MAXSUMMARYUSERS;
             $usershtml .= get_string('moreusers', 'seplfeedback_file', $moreuserscount);
             break;
         }
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
         $usersummary = new sepl_user_summary($user, $this->seplment->get_course()->id, has_capability('moodle/site:viewfullnames', $this->seplment->get_course_context()), $this->seplment->is_blind_marking(), $this->seplment->get_uniqueid_for_user($user->id), get_extra_user_fields($this->seplment->get_context()));
         $usershtml .= $this->seplment->get_renderer()->render($usersummary);
         $usercount += 1;
     }
     $formparams['usershtml'] = $usershtml;
     $mform = new seplfeedback_file_batch_upload_files_form(null, $formparams);
     if ($mform->is_cancelled()) {
         redirect(new moodle_url('view.php', array('id' => $this->seplment->get_course_module()->id, 'action' => 'grading')));
         return;
     } else {
         if ($data = $mform->get_data()) {
             // Copy the files from the draft area to a temporary import area.
             $data = file_postupdate_standard_filemanager($data, 'files', $this->get_file_options(), $this->seplment->get_context(), 'seplfeedback_file', ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);
             $fs = get_file_storage();
             // Now copy each of these files to the users feedback file area.
             foreach ($users as $userid) {
                 $grade = $this->seplment->get_user_grade($userid, true);
                 $this->seplment->notify_grade_modified($grade);
                 $this->copy_area_files($fs, $this->seplment->get_context()->id, 'seplfeedback_file', ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id, $this->seplment->get_context()->id, 'seplfeedback_file', ASSIGNFEEDBACK_FILE_FILEAREA, $grade->id);
                 $filefeedback = $this->get_file_feedback($grade->id);
                 if ($filefeedback) {
                     $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
                     $DB->update_record('seplfeedback_file', $filefeedback);
                 } else {
                     $filefeedback = new stdClass();
                     $filefeedback->numfiles = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
                     $filefeedback->grade = $grade->id;
                     $filefeedback->seplment = $this->seplment->get_instance()->id;
                     $DB->insert_record('seplfeedback_file', $filefeedback);
                 }
             }
             // Now delete the temporary import area.
             $fs->delete_area_files($this->seplment->get_context()->id, 'seplfeedback_file', ASSIGNFEEDBACK_FILE_BATCH_FILEAREA, $USER->id);
             redirect(new moodle_url('view.php', array('id' => $this->seplment->get_course_module()->id, 'action' => 'grading')));
             return;
         } else {
             $header = new sepl_header($this->seplment->get_instance(), $this->seplment->get_context(), false, $this->seplment->get_course_module()->id, get_string('batchuploadfiles', 'seplfeedback_file'));
             $o = '';
             $o .= $this->seplment->get_renderer()->render($header);
             $o .= $this->seplment->get_renderer()->render(new sepl_form('batchuploadfiles', $mform));
             $o .= $this->seplment->get_renderer()->render_footer();
         }
     }
     return $o;
 }
开发者ID:krzpassrl,项目名称:SRL_Moodle_Baseline,代码行数:67,

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP get_extra_user_fields_sql函数代码示例发布时间:2022-05-15
下一篇:
PHP get_extensions函数代码示例发布时间: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