当前位置: 首页>>代码示例>>PHP>>正文


PHP fullname函数代码示例

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


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

示例1: test_event

 /**
  * Test the event.
  */
 public function test_event()
 {
     global $CFG;
     require_once "{$CFG->libdir}/gradelib.php";
     $this->resetAfterTest();
     $course = $this->getDataGenerator()->create_course();
     $user = $this->getDataGenerator()->create_user();
     $this->getDataGenerator()->enrol_user($user->id, $course->id);
     $grade_category = grade_category::fetch_course_category($course->id);
     $grade_category->load_grade_item();
     $grade_item = $grade_category->grade_item;
     $grade_item->update_final_grade($user->id, 10, 'gradebook');
     $grade_grade = new grade_grade(array('userid' => $user->id, 'itemid' => $grade_item->id), true);
     $grade_grade->grade_item = $grade_item;
     $event = \core\event\user_graded::create_from_grade($grade_grade);
     $this->assertEventLegacyLogData(array($course->id, 'grade', 'update', '/report/grader/index.php?id=' . $course->id, $grade_item->itemname . ': ' . fullname($user)), $event);
     $this->assertEquals(context_course::instance($course->id), $event->get_context());
     $this->assertSame($event->objecttable, 'grade_grades');
     $this->assertEquals($event->objectid, $grade_grade->id);
     $this->assertEquals($event->other['itemid'], $grade_item->id);
     $this->assertTrue($event->other['overridden']);
     $this->assertEquals(10, $event->other['finalgrade']);
     // Trigger the events.
     $sink = $this->redirectEvents();
     $event->trigger();
     $result = $sink->get_events();
     $sink->close();
     $this->assertCount(1, $result);
     $event = reset($result);
     $this->assertEventContextNotUsed($event);
     $grade = $event->get_grade();
     $this->assertInstanceOf('grade_grade', $grade);
     $this->assertEquals($grade_grade->id, $grade->id);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:37,代码来源:event_user_graded_test.php

示例2: get_comments

 /**
  * Return comments by pages
  * @param int $page
  * @return mixed
  */
 function get_comments($page)
 {
     global $DB, $CFG, $USER;
     $params = array();
     if ($page == 0) {
         $start = 0;
     } else {
         $start = $page * $this->perpage;
     }
     $sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.firstname, u.lastname, c.timecreated\n            FROM {comments} c, {user} u\n            WHERE u.id=c.userid ORDER BY c.timecreated ASC";
     $comments = array();
     $formatoptions = array('overflowdiv' => true);
     if ($records = $DB->get_records_sql($sql, array(), $start, $this->perpage)) {
         foreach ($records as $item) {
             $item->fullname = fullname($item);
             $item->time = userdate($item->timecreated);
             $item->content = format_text($item->content, FORMAT_MOODLE, $formatoptions);
             $comments[] = $item;
             unset($item->firstname);
             unset($item->lastname);
             unset($item->timecreated);
         }
     }
     return $comments;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:30,代码来源:locallib.php

示例3: test_chat_format_message_manually

 /**
  * @dataProvider chat_format_message_manually_provider
  */
 public function test_chat_format_message_manually($messagetext, $system, $willreturn, $expecttext, $refreshusers, $expectbeep)
 {
     $this->resetAfterTest();
     $course = $this->getDataGenerator()->create_course();
     $currentuser = $this->getDataGenerator()->create_user();
     $this->setUser($currentuser);
     $otheruser = $this->getDataGenerator()->create_user();
     // Replace the message texts.
     // These can't be done in the provider because it runs before the
     // test starts.
     $messagetext = str_replace('__CURRENTUSER__', $currentuser->id, $messagetext);
     $messagetext = str_replace('__OTHERUSER__', $otheruser->id, $messagetext);
     $message = (object) ['message' => $messagetext, 'timestamp' => time(), 'system' => $system];
     $result = chat_format_message_manually($message, $course->id, $currentuser, $currentuser);
     if (!$willreturn) {
         $this->assertFalse($result);
     } else {
         $this->assertNotFalse($result);
         if (!empty($expecttext)) {
             $expecttext = str_replace('__CURRENTUSER__', fullname($currentuser), $expecttext);
             $expecttext = str_replace('__CURRENTUSER_FIRST__', $currentuser->firstname, $expecttext);
             $this->assertRegexp($expecttext, $result->text);
         }
         $this->assertEquals($refreshusers, $result->refreshusers);
         $this->assertEquals($expectbeep, $result->beep);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:30,代码来源:format_message_test.php

示例4: get_content

 function get_content()
 {
     global $USER, $CFG;
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $this->content->footer = '';
     if (empty($this->instance) or empty($USER->id) or isguest() or empty($CFG->messaging)) {
         return $this->content;
     }
     $this->content->footer = '<a href="' . $CFG->wwwroot . '/message/index.php" onclick="this.target=\'message\'; return openpopup(\'/message/index.php\', \'message\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);">' . get_string('messages', 'message') . '</a>...';
     $users = get_records_sql("SELECT m.useridfrom as id, COUNT(m.useridfrom) as count,\n                                         u.firstname, u.lastname, u.picture, u.lastaccess\n                                       FROM {$CFG->prefix}user u, \n                                            {$CFG->prefix}message m \n                                       WHERE m.useridto = '{$USER->id}' \n                                         AND u.id = m.useridfrom\n                                    GROUP BY m.useridfrom, u.firstname,u.lastname,u.picture,u.lastaccess");
     //Now, we have in users, the list of users to show
     //Because they are online
     if (!empty($users)) {
         $this->content->text .= '<ul class="list">';
         foreach ($users as $user) {
             $timeago = format_time(time() - $user->lastaccess);
             $this->content->text .= '<li class="listentry"><div class="user"><a href="' . $CFG->wwwroot . '/user/view.php?id=' . $user->id . '&amp;course=' . $this->instance->pageid . '" title="' . $timeago . '">';
             $this->content->text .= print_user_picture($user->id, $this->instance->pageid, $user->picture, 0, true, false, '', false);
             $this->content->text .= fullname($user) . '</a></div>';
             $this->content->text .= '<div class="message"><a href="' . $CFG->wwwroot . '/message/discussion.php?id=' . $user->id . '" onclick="this.target=\'message_' . $user->id . '\'; return openpopup(\'/message/discussion.php?id=' . $user->id . '\', \'message_' . $user->id . '\', \'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500\', 0);"><img class="iconsmall" src="' . $CFG->pixpath . '/t/message.gif" alt="" />&nbsp;' . $user->count . '</a>';
             $this->content->text .= '</div></li>';
         }
         $this->content->text .= '</ul>';
     } else {
         $this->content->text .= '<div class="info">';
         $this->content->text .= get_string('nomessages', 'message');
         $this->content->text .= '</div>';
     }
     return $this->content;
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:34,代码来源:block_messages.php

示例5: block_exabis_eportfolio_print_extcomments

function block_exabis_eportfolio_print_extcomments($itemid)
{
    $stredit = get_string('edit');
    $strdelete = get_string('delete');
    $comments = get_records("block_exabeporitemcomm", "itemid", $itemid, 'timemodified DESC');
    if (!$comments) {
        return;
    }
    foreach ($comments as $comment) {
        $user = get_record('user', 'id', $comment->userid);
        echo '<table cellspacing="0" class="forumpost blogpost blog" width="100%">';
        echo '<tr class="header"><td class="picture left">';
        print_user_picture($comment->userid, SITEID, $user->picture);
        echo '</td>';
        echo '<td class="topic starter"><div class="author">';
        $fullname = fullname($user, $comment->userid);
        $by = new object();
        $by->name = $fullname;
        $by->date = userdate($comment->timemodified);
        print_string('bynameondate', 'forum', $by);
        echo '</div></td></tr>';
        echo '<tr><td class="left side">';
        echo '</td><td class="content">' . "\n";
        echo format_text($comment->entry);
        echo '</td></tr></table>' . "\n\n";
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:27,代码来源:externlib.php

示例6: get_course_students

function get_course_students($courseID = '')
{
    global $CFG, $DB;
    $users = array();
    $course = $DB->get_record('course', array('id' => $courseID));
    if ($course->id != SITEID) {
        //$courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname, u.idnumber');
        $context = get_context_instance(CONTEXT_COURSE, $courseID);
        $query = 'select u.id as id, firstname, lastname, idnumber, imagealt, email from ' . $CFG->prefix . 'role_assignments as a, ' . $CFG->prefix . 'user as u where contextid=' . $context->id . ' and roleid=5 and a.userid=u.id;';
        $courseusers = $DB->get_recordset_sql($query);
    } else {
        $courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.idnumber");
    }
    //if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
    $showusers = 1;
    //}
    if ($showusers) {
        if ($courseusers) {
            foreach ($courseusers as $courseuser) {
                $users[$courseuser->id] = fullname($courseuser, has_capability('moodle/site:viewfullnames', $context));
            }
        }
        //if ($guest = get_guest()) {
        //    $users[$guest->id] = fullname($guest);
        //}
    }
    return $users;
}
开发者ID:stepsgithub,项目名称:moodle-block_report_module,代码行数:28,代码来源:function.php

示例7: course_info_box

 /**
  * Renders course info box.
  *
  * @param stdClass $course
  * @return string
  */
 public function course_info_box(stdClass $course)
 {
     global $CFG;
     $context = context_course::instance($course->id);
     $content = '';
     $content .= $this->output->box_start('generalbox info');
     $summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', null);
     $content .= format_text($summary, $course->summaryformat, array('overflowdiv' => true), $course->id);
     if (!empty($CFG->coursecontact)) {
         $coursecontactroles = explode(',', $CFG->coursecontact);
         foreach ($coursecontactroles as $roleid) {
             if ($users = get_role_users($roleid, $context, true)) {
                 foreach ($users as $teacher) {
                     $role = new stdClass();
                     $role->id = $teacher->roleid;
                     $role->name = $teacher->rolename;
                     $role->shortname = $teacher->roleshortname;
                     $role->coursealias = $teacher->rolecoursealias;
                     $fullname = fullname($teacher, has_capability('moodle/site:viewfullnames', $context));
                     $namesarray[] = role_get_name($role, $context) . ': <a href="' . $CFG->wwwroot . '/user/view.php?id=' . $teacher->id . '&amp;course=' . SITEID . '">' . $fullname . '</a>';
                 }
             }
         }
         if (!empty($namesarray)) {
             $content .= "<ul class=\"teachers\">\n<li>";
             $content .= implode('</li><li>', $namesarray);
             $content .= "</li></ul>";
         }
     }
     $content .= $this->output->box_end();
     return $content;
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:38,代码来源:renderer.php

示例8: game_showusers

function game_showusers($game)
{
    global $CFG, $USER, $DB;
    $users = array();
    $context = get_context_instance(CONTEXT_COURSE, $game->course);
    $groupid = optional_param('groupid', 0, PARAM_INT);
    $sql = "SELECT DISTINCT ra.userid,u.lastname,u.firstname FROM {role_assignments} ra, {user} u " . " WHERE ra.contextid={$context->id} AND ra.userid=u.id";
    if ($groupid != 0) {
        $sql .= " AND ra.userid IN (SELECT gm.userid FROM {groups_members} gm WHERE gm.groupid={$groupid})";
    }
    if ($recs = $DB->get_records_sql($sql)) {
        foreach ($recs as $rec) {
            $users[$rec->userid] = $rec->lastname . ' ' . $rec->firstname;
        }
    }
    if ($guest = guest_user()) {
        $users[$guest->id] = fullname($guest);
    }
    ?>
            <script type="text/javascript">
                function onselectuser()
                {
                    window.location.href = "<?php 
    echo $CFG->wwwroot . '/mod/game/showattempts.php?q=' . $game->id . '&userid=';
    ?>
" + document.getElementById('menuuser').value + '&groupid=' + document.getElementById('menugroup').value;
                }
            </script>
        <?php 
    $attributes = 'onchange="javascript:onselectuser();"';
    $name = 'user';
    $id = 'menu' . $name;
    $class = 'menu' . $name;
    $class = 'select ' . $class;
    /// Add 'select' selector always
    $nothing = get_string("allparticipants");
    $nothingvalue = '0';
    $options = $users;
    $selected = optional_param('userid', 0, PARAM_INT);
    $output = '<select id="' . $id . '" class="' . $class . '" name="' . $name . '" ' . $attributes . '>' . "\n";
    $output .= '   <option value="' . s($nothingvalue) . '"' . "\n";
    if ($nothingvalue === $selected) {
        $output .= ' selected="selected"';
    }
    $output .= '>' . $nothing . '</option>' . "\n";
    if (!empty($options)) {
        foreach ($options as $value => $label) {
            $output .= '   <option value="' . s($value) . '"';
            if ((string) $value == (string) $selected || is_array($selected) && in_array($value, $selected)) {
                $output .= ' selected="selected"';
            }
            if ($label === '') {
                $output .= '>' . $value . '</option>' . "\n";
            } else {
                $output .= '>' . $label . '</option>' . "\n";
            }
        }
    }
    echo $output . '</select>' . "\n";
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:60,代码来源:showattempts.php

示例9: definition

 function definition()
 {
     global $USER, $CFG;
     $mform =& $this->_form;
     $mform->addElement('header', '', get_string('createuserandpass'), '');
     $mform->addElement('text', 'username', get_string('username'), 'maxlength="100" size="12"');
     $mform->setType('username', PARAM_NOTAGS);
     $mform->addRule('username', get_string('missingusername'), 'required', null, 'server');
     $mform->addElement('passwordunmask', 'password', get_string('password'), 'maxlength="32" size="12"');
     $mform->setType('password', PARAM_RAW);
     $mform->addRule('password', get_string('missingpassword'), 'required', null, 'server');
     $mform->addElement('header', '', get_string('supplyinfo'), '');
     $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"');
     $mform->setType('email', PARAM_NOTAGS);
     $mform->addRule('email', get_string('missingemail'), 'required', null, 'server');
     $mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"');
     $mform->setType('email2', PARAM_NOTAGS);
     $mform->addRule('email2', get_string('missingemail'), 'required', null, 'server');
     $nameordercheck = new object();
     $nameordercheck->firstname = 'a';
     $nameordercheck->lastname = 'b';
     if (fullname($nameordercheck) == 'b a') {
         // See MDL-4325
         $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"');
         $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"');
     } else {
         $mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"');
         $mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"');
     }
     $mform->setType('firstname', PARAM_TEXT);
     $mform->addRule('firstname', get_string('missingfirstname'), 'required', null, 'server');
     $mform->setType('lastname', PARAM_TEXT);
     $mform->addRule('lastname', get_string('missinglastname'), 'required', null, 'server');
     $mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="20"');
     $mform->setType('city', PARAM_TEXT);
     $mform->addRule('city', get_string('missingcity'), 'required', null, 'server');
     $country = get_list_of_countries();
     $default_country[''] = get_string('selectacountry');
     $country = array_merge($default_country, $country);
     $mform->addElement('select', 'country', get_string('country'), $country);
     $mform->addRule('country', get_string('missingcountry'), 'required', null, 'server');
     if (!empty($CFG->country)) {
         $mform->setDefault('country', $CFG->country);
     } else {
         $mform->setDefault('country', '');
     }
     if (signup_captcha_enabled()) {
         $mform->addElement('recaptcha', 'recaptcha_element', get_string('recaptcha', 'auth'), array('https' => $CFG->loginhttps));
         $mform->setHelpButton('recaptcha_element', array('recaptcha', get_string('recaptcha', 'auth')));
     }
     profile_signup_fields($mform);
     if (!empty($CFG->sitepolicy)) {
         $mform->addElement('header', '', get_string('policyagreement'), '');
         $mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>');
         $mform->addElement('checkbox', 'policyagreed', get_string('policyaccept'));
         $mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server');
     }
     // buttons
     $this->add_action_buttons(true, get_string('createaccount'));
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:60,代码来源:signup_form.php

示例10: i_send_message_to_user

    /**
     * Sends a message to the specified user from the logged user.
     *
     * @Given /^I send "(?P<message_contents_string>(?:[^"]|\\")*)" message to "(?P<username_string>(?:[^"]|\\")*)"$/
     * @throws ElementNotFoundException
     * @param string $messagecontent
     * @param string $tousername
     */
    public function i_send_message_to_user($messagecontent, $tousername) {

        global $DB;

        // Runs by CLI, same PHP process that created the user.
        $touser = $DB->get_record('user', array('username' => $tousername));
        if (!$touser) {
            throw new ElementNotFoundException($this->getSession(), '"' . $tousername . '" ');
        }
        $tofullname = fullname($touser);

        $steps = array();
        $steps[] = new Given('I am on homepage');

        if ($this->running_javascript()) {
            $steps[] = new Given('I expand "My profile" node');
        }

        $steps[] = new Given('I follow "Messages"');
        $steps[] = new Given('I fill in "' . get_string('searchcombined', 'message') . '" with "' . $tofullname . '"');
        $steps[] = new Given('I press "' . get_string('searchcombined', 'message') . '"');
        $steps[] = new Given('I follow "' . get_string('sendmessageto', 'message', $tofullname) . '"');
        $steps[] = new Given('I fill in "id_message" with "' . $messagecontent . '"');
        $steps[] = new Given('I press "' . get_string('sendmessage', 'message') . '"');

        return $steps;
    }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:35,代码来源:behat_message.php

示例11: course_report

 /**
  * course_report
  *
  * @param mixed $indicators
  * @param mixed $data
  * @access public
  * @return void
  */
 public function course_report($indicators, $data)
 {
     global $DB, $COURSE;
     if (empty($data)) {
         return '';
     }
     $table = new flexible_table('engagement-course-report');
     $table->define_baseurl(new moodle_url('/report/engagement/index.php', array('id' => $COURSE->id)));
     $headers = array();
     $columns = array();
     $headers[] = get_string('username');
     $columns[] = 'username';
     foreach ($indicators as $indicator) {
         $headers[] = get_string('pluginname', "engagementindicator_{$indicator}");
         $columns[] = "indicator_{$indicator}";
     }
     $headers[] = get_string('total');
     $columns[] = 'total';
     $table->define_headers($headers);
     $table->define_columns($columns);
     $table->sortable(true, 'total', SORT_DESC);
     $table->no_sorting('username');
     $table->column_class('username', 'student');
     foreach ($indicators as $indicator) {
         $table->column_class("indicator_{$indicator}", 'indicator');
     }
     $table->column_class('total', 'total');
     $table->set_attribute('id', 'engagement-course-report');
     $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
     $table->setup();
     foreach ($data as $user => $ind_data) {
         $row = array();
         $displayname = fullname($DB->get_record('user', array('id' => $user)));
         $url = new moodle_url('/course/report/engagement/index.php', array('id' => $COURSE->id, 'userid' => $user));
         $row[] = html_writer::link($url, $displayname);
         $total = 0;
         $total_raw = 0;
         foreach ($indicators as $indicator) {
             if (isset($ind_data["indicator_{$indicator}"]['raw'])) {
                 $ind_value = $ind_data["indicator_{$indicator}"]['raw'];
                 $weight = $ind_data["indicator_{$indicator}"]['weight'];
             } else {
                 $ind_value = 0;
                 $weight = 0;
             }
             $weighted_value = sprintf("%.0f%%", $ind_value * $weight * 100);
             $raw_value = sprintf("%.0f%%", 100 * $ind_value);
             $row[] = $weighted_value . " ({$raw_value})";
             $total += $ind_value * $weight;
             $total_raw += $ind_value;
         }
         $row[] = sprintf("%.0f%%", $total * 100);
         $table->add_data($row);
     }
     $html = $this->output->notification(get_string('reportdescription', 'coursereport_engagement'));
     ob_start();
     $table->finish_output();
     $html .= ob_get_clean();
     return $html;
 }
开发者ID:netspotau,项目名称:moodle-coursereport_engagement,代码行数:68,代码来源:renderer.php

示例12: i_add_user_to_group

 /**
  * Add the specified user to the group. You should be in the groups page when running this step.
  *
  * @Given /^I add "(?P<username_string>(?:[^"]|\\")*)" user to "(?P<group_name_string>(?:[^"]|\\")*)" group$/
  * @throws ElementNotFoundException Thrown by behat_base::find
  * @param string $username
  * @param string $groupname
  */
 public function i_add_user_to_group($username, $groupname)
 {
     global $DB;
     $user = $DB->get_record('user', array('username' => $username));
     $userfullname = fullname($user);
     // We don't know the option text as it contains the number of users in the group.
     $select = $this->find_field('groups');
     $xpath = "//select[@id='groups']/descendant::option[contains(., '" . $groupname . "')]";
     $groupoption = $this->find('xpath', $xpath);
     $fulloption = $groupoption->getText();
     $select->selectOption($fulloption);
     // Here we don't need to wait for the AJAX response.
     $this->find_button('Add/remove users')->click();
     // Wait for add/remove members page to be loaded.
     $this->getSession()->wait(self::TIMEOUT, '(document.readyState === "complete")');
     // Getting the option and selecting it.
     $select = $this->find_field('addselect');
     $xpath = "//select[@id='addselect']/descendant::option[contains(., '" . $userfullname . "')]";
     $memberoption = $this->find('xpath', $xpath);
     $fulloption = $memberoption->getText();
     $select->selectOption($fulloption);
     // Click add button.
     $this->find_button('Add')->click();
     // Wait for the page to load.
     $this->getSession()->wait(self::TIMEOUT, '(document.readyState === "complete")');
     // Returning to the main groups page.
     $this->find_button('Back to groups')->click();
 }
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:36,代码来源:behat_groups.php

示例13: export_for_template

 public function export_for_template(\renderer_base $output)
 {
     global $USER;
     $data = new \stdClass();
     $data->iscurrentuser = $USER->id == $this->currentuserid;
     $data->currentuserid = $this->currentuserid;
     if ($this->otheruserid) {
         $data->otheruserid = $this->otheruserid;
         $data->otheruserfullname = fullname($this->otheruser);
     }
     $data->isonline = null;
     if ($this->otheruserid) {
         if (\core_message\helper::show_online_status($this->otheruser)) {
             $data->isonline = \core_message\helper::is_online($this->otheruser->lastaccess);
         }
     }
     $data->showonlinestatus = is_null($data->isonline) ? false : true;
     $data->messages = array();
     foreach ($this->messages as $message) {
         $message = new message($message);
         $data->messages[] = $message->export_for_template($output);
     }
     $data->isblocked = api::is_user_blocked($this->currentuserid, $this->otheruserid);
     return $data;
 }
开发者ID:Chocolate-lightning,项目名称:moodle,代码行数:25,代码来源:messages.php

示例14: get_hawthorn

/**
 * Creates a new Hawthorn object.
 * @param object $course Moodle course object. If not supplied, uses $COURSE.
 *   Only required field is ->id.
 */
function get_hawthorn($course = null)
{
    global $USER, $COURSE, $CFG;
    if ($course == null) {
        $course = $COURSE;
    }
    $context = get_context_instance(CONTEXT_COURSE, $course->id);
    // Work out user permissions
    $permissions = '';
    if (has_capability('block/hawthorn:chat', $context)) {
        $permissions .= 'rw';
    }
    if (has_capability('block/hawthorn:moderate', $context)) {
        $permissions .= 'm';
    }
    if (has_capability('block/hawthorn:admin', $context)) {
        $permissions .= 'a';
    }
    // Get user picture URL
    $userpic = print_user_picture($USER, $COURSE->id, NULL, 0, true, false);
    $userpic = preg_replace('~^.*src="([^"]*)".*$~', '$1', $userpic);
    // Decide key expiry (ms). Usually 1 hour, unless session timeout is lower.
    $keyExpiry = 3600000;
    if ($CFG->sessiontimeout * 1000 < $keyExpiry) {
        // Set expiry to session timeout (note that the JS will make a re-acquire
        // request 5 minutes before this)
        $keyExpiry = $CFG->sessiontimeout * 1000;
    }
    // Get server list
    $servers = empty($CFG->block_hawthorn_servers) ? array() : explode(',', $CFG->block_hawthorn_servers);
    $magicnumber = empty($CFG->block_hawthorn_magicnumber) ? 'xxx' : $CFG->block_hawthorn_magicnumber;
    // Construct Hawthorn object
    return new hawthorn($magicnumber, $servers, hawthorn::escapeId($USER->username), fullname($USER), $userpic, $permissions, $CFG->wwwroot . '/blocks/hawthorn/hawthorn.js', $CFG->wwwroot . '/blocks/hawthorn/popup.php', $CFG->wwwroot . '/blocks/hawthorn/reacquire.php', false, $keyExpiry);
}
开发者ID:quen,项目名称:hawthorn,代码行数:39,代码来源:hawthornlib.php

示例15: definition

 public function definition()
 {
     global $OUTPUT;
     $mform = $this->_form;
     $user = $this->_customdata['user'];
     $lastupdate = $this->_customdata['lastupdate'];
     $dategraded = $this->_customdata['dategraded'];
     // Hidden params.
     $mform->addElement('hidden', 'userid', 0);
     $mform->setType('userid', PARAM_INT);
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('static', 'picture', $OUTPUT->user_picture($user), fullname($user, true) . '<br/>' . get_string('lastupdated', 'mod_giportfolio') . date('l jS \\of F Y ', $lastupdate));
     $this->add_grades_section();
     $mform->addElement('header', 'Feed Back', get_string('feedback', 'grades'));
     $mform->addElement('textarea', 'feedback', get_string('feedback', 'grades'), 'wrap="virtual" rows="10" cols="50"');
     if ($dategraded) {
         $datestring = userdate($dategraded) . "&nbsp; (" . format_time(time() - $dategraded) . ")";
         $mform->addElement('header', 'Last Grade', get_string('lastgrade', 'assignment'));
         $mform->addElement('static', 'lastgrade', get_string('lastgrade', 'mod_giportfolio') . ':', $datestring);
     }
     // Buttons.
     $this->add_action_buttons();
     $mform->setDisableShortforms(true);
 }
开发者ID:andrewhancox,项目名称:moodle-mod_giportfolio,代码行数:25,代码来源:updategrade_form.php


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