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

PHP get_user_preferences函数代码示例

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

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



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

示例1: editors_get_preferred_editor

/**
 * Returns users preferred editor for given format
 *
 * @param int $format text format or null of none
 * @return texteditor object
 */
function editors_get_preferred_editor($format = NULL)
{
    global $USER;
    $enabled = editors_get_enabled();
    $preference = get_user_preferences('htmleditor', '', $USER);
    if (isset($enabled[$preference])) {
        // Edit the list of editors so the users preferred editor is first in the list.
        $editor = $enabled[$preference];
        unset($enabled[$preference]);
        array_unshift($enabled, $editor);
    }
    // now find some plugin that supports format and is available
    $editor = false;
    foreach ($enabled as $e) {
        if (!$e->supported_by_browser()) {
            // bad luck, this editor is not compatible
            continue;
        }
        if (!($supports = $e->get_supported_formats())) {
            // buggy editor!
            continue;
        }
        if (is_null($format) || in_array($format, $supports)) {
            // editor supports this format, yay!
            $editor = $e;
            break;
        }
    }
    if (!$editor) {
        $editor = get_texteditor('textarea');
        // must exist and can edit anything
    }
    return $editor;
}
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:40,代码来源:editorlib.php


示例2: __construct

 /**
  * Constructor
  */
 public function __construct($gtree, $moving = false, $gpr)
 {
     global $USER, $OUTPUT, $COURSE;
     $systemdefault = get_config('moodle', 'grade_report_showcalculations');
     $this->show_calculations = get_user_preferences('grade_report_showcalculations', $systemdefault);
     $this->gtree = $gtree;
     $this->moving = $moving;
     $this->gpr = $gpr;
     $this->deepest_level = $this->get_deepest_level($this->gtree->top_element);
     $this->columns = array(grade_edit_tree_column::factory('name', array('deepest_level' => $this->deepest_level)));
     if ($this->uses_weight) {
         $this->columns[] = grade_edit_tree_column::factory('weight', array('adv' => 'weight'));
     }
     $this->columns[] = grade_edit_tree_column::factory('range');
     // This is not a setting... How do we deal with it?
     $this->columns[] = grade_edit_tree_column::factory('actions');
     if ($this->deepest_level > 1) {
         $this->columns[] = grade_edit_tree_column::factory('select');
     }
     $this->table = new html_table();
     $this->table->id = "grade_edit_tree_table";
     $this->table->attributes['class'] = 'generaltable simple setup-grades';
     if ($this->moving) {
         $this->table->attributes['class'] .= ' moving';
     }
     foreach ($this->columns as $column) {
         if (!($this->moving && $column->hide_when_moving)) {
             $this->table->head[] = $column->get_header_cell();
         }
     }
     $rowcount = 0;
     $this->table->data = $this->build_html_tree($this->gtree->top_element, true, array(), 0, $rowcount);
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:36,代码来源:lib.php


示例3: __create

 public function __create($bookmarkurl, $title, $tokenval)
 {
     global $CFG, $DB;
     $response = new CliniqueServiceResponce();
     $token_val = array('token' => $tokenval);
     $userId = array_values($DB->get_records_sql('SELECT userid FROM {external_tokens} et WHERE et.token=?', $token_val));
     if ($userId) {
         $user_id = array('id' => $userId[0]->userid);
         //if(confirm_sesskey()){
         $user = array_values($DB->get_records_sql('SELECT * FROM {user} u WHERE u.id=?', $user_id));
         Favorites::__fav_user_login($user['0']);
         if (get_user_preferences('user_bookmarks')) {
             $bookmarks = explode(',', get_user_preferences('user_bookmarks'));
             if (in_array($bookmarkurl . ";" . $title, $bookmarks)) {
                 $response->response(true, 'You have already bookmarked');
                 die;
             }
         } else {
             $bookmarks = array();
         }
         //adds the bookmark at end of array
         $bookmarks[] = $bookmarkurl . ";" . $title;
         $bookmarks = implode(',', $bookmarks);
         //adds to preferences table
         set_user_preference('user_bookmarks', $bookmarks);
         global $CFG;
         //header("Location: " . $CFG->wwwroot . "/");
         //print "Added Favourite Successfully";
         $response->response(false, 'Added Favourite Successfully');
         die;
     } else {
         $response->response(false, 'Invalid user');
         die;
     }
 }
开发者ID:vinoth4891,项目名称:clinique,代码行数:35,代码来源:create.php


示例4: get_field

 /**
  * get_field
  *
  * @param xxx $fieldname
  * @param xxx $advanced
  * @return xxx
  */
 function get_field($fieldname, $advanced)
 {
     // hotpot version of standard function
     $default = get_user_preferences('hotpot_' . $fieldname, '');
     $rawdata = data_submitted();
     if ($rawdata && isset($rawdata->{$fieldname}) && !is_array($rawdata->{$fieldname})) {
         $default = optional_param($fieldname, $default, PARAM_ALPHANUM);
     }
     unset($rawdata);
     switch ($fieldname) {
         case 'group':
         case 'grouping':
             return new hotpot_filter_group($fieldname, $advanced, $default);
         case 'grade':
             $label = get_string('grade');
             return new hotpot_filter_grade($fieldname, $label, $advanced, $default);
         case 'timemodified':
             $label = get_string('time', 'quiz');
             return new user_filter_date($fieldname, $label, $advanced, $fieldname);
         case 'status':
             return new hotpot_filter_status($fieldname, $advanced, $default);
         case 'duration':
             $label = get_string('duration', 'mod_hotpot');
             return new hotpot_filter_duration($fieldname, $label, $advanced, $default);
         case 'penalties':
             $label = get_string('penalties', 'mod_hotpot');
             return new hotpot_filter_number($fieldname, $label, $advanced, $default);
         case 'score':
             $label = get_string('score', 'quiz');
             return new hotpot_filter_number($fieldname, $label, $advanced, $default);
         default:
             // other fields (e.g. from user record)
             return parent::get_field($fieldname, $advanced);
     }
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:42,代码来源:userfiltering.php


示例5: setup_from_user_preferences

    public function setup_from_user_preferences() {
        parent::setup_from_user_preferences();

        $this->showqtext     = get_user_preferences('quiz_report_responses_qtext', $this->showqtext);
        $this->showresponses = get_user_preferences('quiz_report_responses_resp',  $this->showresponses);
        $this->showright     = get_user_preferences('quiz_report_responses_right', $this->showright);
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:7,代码来源:responses_options.php


示例6: definition

 function definition()
 {
     global $USER;
     $mform =& $this->_form;
     $mform->addElement('header', '', get_string('changepassword'), '');
     // visible elements
     $mform->addElement('static', 'username', get_string('username'), $USER->username);
     $mform->addElement('password', 'password', get_string('oldpassword'));
     $mform->addRule('password', get_string('required'), 'required', null, 'client');
     $mform->setType('password', PARAM_RAW);
     $mform->addElement('password', 'newpassword1', get_string('newpassword'));
     $mform->addRule('newpassword1', get_string('required'), 'required', null, 'client');
     $mform->setType('newpassword1', PARAM_RAW);
     $mform->addElement('password', 'newpassword2', get_string('newpassword') . ' (' . get_String('again') . ')');
     $mform->addRule('newpassword2', get_string('required'), 'required', null, 'client');
     $mform->setType('newpassword2', PARAM_RAW);
     // hidden optional params
     $mform->addElement('hidden', 'id', 0);
     $mform->setType('id', PARAM_INT);
     // buttons
     if (get_user_preferences('auth_forcepasswordchange')) {
         $this->add_action_buttons(false);
     } else {
         $this->add_action_buttons(true);
     }
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:26,代码来源:change_password_form.php


示例7: __construct

 public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array())
 {
     $options['page'] = optional_param('p', 1, PARAM_INT);
     parent::__construct($repositoryid, $context, $options);
     // if moodle is telling us what kind of mimetypes it wants, we check to see if it happens to be just ZIP.
     // If that's the case, we know we're on a SCORM page, because in all other cases supported_filetypes() will return web_image
     // this allows us to override our own type and act like a SCORM supplier.
     if (isset($options['mimetypes'])) {
         if (in_array(".zip", $options['mimetypes'])) {
             $this->fileTypes = "zipscorm";
             $this->fileExtension = ".zip";
         }
     }
     $this->setting = 'elevator_';
     $elevatorURL = get_config('elevator', 'elevatorURL');
     $apiKey = get_config('elevator', 'apiKey');
     $apiSecret = get_config('elevator', 'apiSecret');
     if (isset($options['userId'])) {
         $this->userId = $options['userId'];
     } else {
         $this->userId = get_user_preferences($this->setting . '_userId', '');
     }
     $this->repositoryId = $repositoryid;
     // initiate an instance of the elevator API, which handles all the backend communication.
     $this->elevatorAPI = new elevatorAPI($elevatorURL, $apiKey, $apiSecret, $this->userId);
     $this->elevatorAPI->fileTypes = $this->fileTypes;
     if ($this->userId) {
         $this->loggedIn = $this->testUserId();
         $this->manageURL = $this->elevatorAPI->getManageURL();
     }
 }
开发者ID:UMN-LATIS,项目名称:moodle-repository_elevator,代码行数:31,代码来源:lib.php


示例8: load_data

 public function load_data(&$preferences, $userid)
 {
     $preferences->showmessagewindow = get_user_preferences('message_showmessagewindow', 1, $userid);
     $preferences->blocknoncontacts = get_user_preferences('message_blocknoncontacts', '', $userid);
     $preferences->beepnewmessage = get_user_preferences('message_beepnewmessage', '', $userid);
     $preferences->noframesjs = get_user_preferences('message_noframesjs', '', $userid);
     return true;
 }
开发者ID:ajv,项目名称:Offline-Caching,代码行数:8,代码来源:message_output_popup.php


示例9: _add_column_select

 private function _add_column_select()
 {
     global $DB, $CFG;
     $mform = $this->_form;
     $data =& $this->_customdata;
     $params = array('slotid' => reset($data['slots']));
     $isgrouporganizer = $DB->get_field_sql("SELECT o.isgrouporganizer\n                FROM {organizer} o\n                INNER JOIN {organizer_slots} s ON o.id = s.organizerid\n                WHERE s.id = :slotid", $params);
     $identityfields = explode(',', $CFG->showuseridentity);
     if (array_search('idnumber', $identityfields) !== false) {
         $selcols = array('datetime', 'location', 'teacher', 'participant', 'idnumber', 'attended', 'grade', 'feedback');
     } else {
         $selcols = array('datetime', 'location', 'teacher', 'participant', 'attended', 'grade', 'feedback');
     }
     $this->_selcols = $selcols;
     if ($isgrouporganizer) {
         array_splice($selcols, 3, 0, 'groupname');
     }
     $mform->addElement('header', 'export_settings_header', get_string('exportsettings', 'organizer'));
     $exportformats = array('pdf' => get_string('format_pdf', 'organizer'), 'xlsx' => get_string('format_xlsx', 'organizer'), 'xls' => get_string('format_xls', 'organizer'), 'ods' => get_string('format_ods', 'organizer'), 'csv_tab' => get_string('format_csv_tab', 'organizer'), 'csv_comma' => get_string('format_csv_comma', 'organizer'));
     $mform->addElement('select', 'format', get_string('format', 'organizer'), $exportformats);
     $mform->addElement('static', 'pdf_settings', get_string('pdfsettings', 'organizer'));
     $entriesperpage = get_user_preferences('organizer_printperpage', 20);
     $printperpage_optimal = get_user_preferences('organizer_printperpage_optimal', 0);
     $textsize = get_user_preferences('organizer_textsize', 10);
     $pageorientation = get_user_preferences('organizer_pageorientation', 'P');
     $headerfooter = get_user_preferences('organizer_headerfooter', 1);
     // submissions per page
     $pppgroup = array();
     $pppgroup[] =& $mform->createElement('text', 'entriesperpage', get_string('numentries', 'organizer'), array('size' => '2'));
     $pppgroup[] =& $mform->createElement('advcheckbox', 'printperpage_optimal', get_string('stroptimal', 'organizer'), get_string('stroptimal', 'organizer'), array("group" => 1));
     $mform->addGroup($pppgroup, 'printperpagegrp', get_string('numentries', 'organizer'), array(' '), false);
     $mform->setType('entriesperpage', PARAM_INT);
     $mform->setDefault('entriesperpage', $entriesperpage);
     $mform->setDefault('printperpage_optimal', $printperpage_optimal);
     $mform->addHelpButton('printperpagegrp', 'numentries', 'organizer');
     $mform->disabledIf('entriesperpage', 'printperpage_optimal', 'checked');
     $mform->disabledIf('printperpagegrp', 'format', 'neq', 'pdf');
     $mform->addElement('select', 'textsize', get_string('textsize', 'organizer'), array('8' => get_string('font_small', 'organizer'), '10' => get_string('font_medium', 'organizer'), '12' => get_string('font_large', 'organizer')));
     $mform->setDefault('textsize', $textsize);
     $mform->disabledIf('textsize', 'format', 'neq', 'pdf');
     $mform->addElement('select', 'pageorientation', get_string('pageorientation', 'organizer'), array('P' => get_string('orientationportrait', 'organizer'), 'L' => get_string('orientationlandscape', 'organizer')));
     $mform->setDefault('pageorientation', $pageorientation);
     $mform->disabledIf('pageorientation', 'format', 'neq', 'pdf');
     $mform->addElement('advcheckbox', 'headerfooter', get_string('headerfooter', 'organizer'), null, null, array(0, 1));
     $mform->setType('headerfooter', PARAM_BOOL);
     $mform->setDefault('headerfooter', $headerfooter);
     $mform->addHelpButton('headerfooter', 'headerfooter', 'organizer');
     $mform->disabledIf('headerfooter', 'format', 'neq', 'pdf');
     $buttonarray = array();
     $buttonarray[] =& $mform->createElement('submit', 'downloadfile', get_string('downloadfile', 'organizer'));
     $buttonarray[] =& $mform->createElement('cancel', 'cancel', get_string('print_return', 'organizer'));
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     foreach ($selcols as $key => $selcol) {
         $mform->addElement('hidden', "cols[{$key}]", $selcol, array('id' => "col_{$selcol}"));
         $mform->setType("cols[{$key}]", PARAM_ALPHANUMEXT);
     }
 }
开发者ID:nmisic,项目名称:moodle-mod_organizer,代码行数:57,代码来源:view_action_form_print.php


示例10: definition

 public function definition()
 {
     global $USER, $CFG;
     $mform =& $this->_form;
     $strpagesize = get_string('pagesize', 'blog');
     $mform->addElement('text', 'pagesize', $strpagesize);
     $mform->setDefault('pagesize', get_user_preferences('pagesize'));
     $this->add_action_buttons();
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:9,代码来源:preferences_form.php


示例11: test_user_update_password

 /**
  * Test user_update_password method.
  */
 public function test_user_update_password()
 {
     $user = $this->getDataGenerator()->create_user();
     $expectedtime = time();
     $passwordisupdated = $this->authplugin->user_update_password($user, 'MyNewPassword*');
     // Assert that the actual time should be equal or a little greater than the expected time.
     $this->assertGreaterThanOrEqual($expectedtime, get_user_preferences('auth_manual_passwordupdatetime', 0, $user->id));
     // Assert that the password was successfully updated.
     $this->assertTrue($passwordisupdated);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:manual_test.php


示例12: get_content

 /**
  * Gets the content for this block
  */
 function get_content()
 {
     global $CFG;
     // First check if we have already generated, don't waste cycles
     if ($this->contentgenerated === true) {
         return $this->content;
     }
     $this->content = new stdClass();
     if (get_user_preferences('admin_bookmarks')) {
         require_once $CFG->libdir . '/adminlib.php';
         $adminroot = admin_get_root(false, false);
         // settings not required - only pages
         $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
         /// Accessibility: markup as a list.
         $contents = array();
         foreach ($bookmarks as $bookmark) {
             $temp = $adminroot->locate($bookmark);
             if ($temp instanceof admin_settingpage) {
                 $contenturl = new moodle_url('/admin/settings.php', array('section' => $bookmark));
                 $contentlink = html_writer::link($contenturl, $temp->visiblename);
                 $contents[] = html_writer::tag('li', $contentlink);
             } else {
                 if ($temp instanceof admin_externalpage) {
                     $contenturl = new moodle_url($temp->url);
                     $contentlink = html_writer::link($contenturl, $temp->visiblename);
                     $contents[] = html_writer::tag('li', $contentlink);
                 }
             }
         }
         $this->content->text = html_writer::tag('ol', implode('', $contents), array('class' => 'list'));
     } else {
         $bookmarks = array();
     }
     $this->content->footer = '';
     $this->page->settingsnav->initialise();
     $node = $this->page->settingsnav->get('root', navigation_node::TYPE_SITE_ADMIN);
     if (!$node || !$node->contains_active_node()) {
         return $this->content;
     }
     $section = $node->find_active_node()->key;
     if ($section == 'search' || empty($section)) {
         // the search page can't be properly bookmarked at present
         $this->content->footer = '';
     } else {
         if (in_array($section, $bookmarks)) {
             $deleteurl = new moodle_url('/blocks/admin_bookmarks/delete.php', array('section' => $section, 'sesskey' => sesskey()));
             $this->content->footer = html_writer::link($deleteurl, get_string('unbookmarkthispage', 'admin'));
         } else {
             $createurl = new moodle_url('/blocks/admin_bookmarks/create.php', array('section' => $section, 'sesskey' => sesskey()));
             $this->content->footer = html_writer::link($createurl, get_string('bookmarkthispage', 'admin'));
         }
     }
     return $this->content;
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:57,代码来源:block_admin_bookmarks.php


示例13: ungraded_assignments_get_rownum

/**
 * Find the rownum for a userid and assign mod to user for grading url
 *
 * @param stdClass $cm course module object
 * @param in $userid the id of the user whose rownum we are interested in
 *
 * @return int 
 */
function ungraded_assignments_get_rownum($cm, $userid)
{
    global $COURSE;
    $mod_context = context_module::instance($cm->id);
    $assign = new assign($mod_context, $cm, $COURSE);
    $filter = get_user_preferences('assign_filter', '');
    $table = new assign_grading_table($assign, 0, $filter, 0, false);
    $useridlist = $table->get_column_data('userid');
    $rownum = array_search($userid, $useridlist);
    return $rownum;
}
开发者ID:jb-1980,项目名称:ungraded_assignments,代码行数:19,代码来源:lib.php


示例14: scheduler_usertime

/**
* Parameter $local added by power-web.at 
* When local Time is needed the $local Param must be set to 1 
* @param int $date a timestamp
* @param int $local
* @todo check consistence
* @return string printable time
*/
function scheduler_usertime($date, $local = 0)
{
    if ($date == 0) {
        return '';
    } else {
        if (!($timeformat = get_user_preferences('calendar_timeformat'))) {
            $timeformat = get_string('strftimetime');
        }
        return userdate($date, $timeformat);
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:19,代码来源:locallib.php


示例15: get_userid

 public static function get_userid()
 {
     global $USER;
     // Get the users whose annotations are to be shown
     $annotationuser = get_user_preferences(AN_USER_PREF, null);
     if (null == $annotationuser) {
         $annotationuser = isguest() ? null : $USER->username;
         set_user_preference(AN_USER_PREF, $annotationuser);
     }
     return $annotationuser;
 }
开发者ID:njorth,项目名称:marginalia,代码行数:11,代码来源:lib.php


示例16: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     $this->content = new stdClass();
     $this->content->text = '';
     $filtercourse = array();
     if (empty($this->instance)) {
         // Overrides: use no course at all
         $courseshown = false;
         $this->content->footer = '';
     } else {
         $courseshown = $this->page->course->id;
         $this->content->footer = '<div class="gotocal"><a href="' . $CFG->wwwroot . '/calendar/view.php?view=upcoming&amp;course=' . $courseshown . '">' . get_string('gotocalendar', 'calendar') . '</a>...</div>';
         $context = context_course::instance($courseshown);
         if (has_any_capability(array('moodle/calendar:manageentries', 'moodle/calendar:manageownentries'), $context)) {
             $this->content->footer .= '<div class="newevent"><a href="' . $CFG->wwwroot . '/calendar/event.php?action=new&amp;course=' . $courseshown . '">' . get_string('newevent', 'calendar') . '</a>...</div>';
         }
         if ($courseshown == SITEID) {
             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
             // the list of courses it will be grabbing events from.
             $filtercourse = calendar_get_default_courses();
         } else {
             // Forcibly filter events to include only those from the particular course we are in.
             $filtercourse = array($courseshown => $this->page->course);
         }
     }
     list($courses, $group, $user) = calendar_set_filters($filtercourse);
     $defaultlookahead = CALENDAR_DEFAULT_UPCOMING_LOOKAHEAD;
     if (isset($CFG->calendar_lookahead)) {
         $defaultlookahead = intval($CFG->calendar_lookahead);
     }
     $lookahead = get_user_preferences('calendar_lookahead', $defaultlookahead);
     $defaultmaxevents = CALENDAR_DEFAULT_UPCOMING_MAXEVENTS;
     if (isset($CFG->calendar_maxevents)) {
         $defaultmaxevents = intval($CFG->calendar_maxevents);
     }
     $maxevents = get_user_preferences('calendar_maxevents', $defaultmaxevents);
     $events = calendar_get_upcoming($courses, $group, $user, $lookahead, $maxevents);
     if (!empty($this->instance)) {
         $this->content->text = calendar_get_block_upcoming($events, 'view.php?view=day&amp;course=' . $courseshown . '&amp;');
     }
     if (empty($this->content->text)) {
         $this->content->text = '<div class="post">' . get_string('noupcomingevents', 'calendar') . '</div>';
     }
     return $this->content;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:52,代码来源:block_calendar_upcoming.php


示例17: get_content

 function get_content()
 {
     global $USER, $CFG, $SESSION, $COURSE;
     $cal_m = optional_param('cal_m', 0, PARAM_INT);
     $cal_y = optional_param('cal_y', 0, PARAM_INT);
     require_once $CFG->dirroot . '/calendar/lib.php';
     if ($this->content !== NULL) {
         return $this->content;
     }
     // Reset the session variables
     calendar_session_vars($COURSE);
     $this->content = new stdClass();
     $this->content->text = '';
     if (empty($this->instance)) {
         // Overrides: use no course at all
         $courseshown = false;
         $filtercourse = array();
         $this->content->footer = '';
     } else {
         $courseshown = $COURSE->id;
         $this->content->footer = '<br /><a href="' . $CFG->wwwroot . '/calendar/view.php?view=upcoming&amp;course=' . $courseshown . '">' . get_string('gotocalendar', 'calendar') . '</a>...';
         $context = get_context_instance(CONTEXT_COURSE, $courseshown);
         if (has_capability('moodle/calendar:manageentries', $context) || has_capability('moodle/calendar:manageownentries', $context)) {
             $this->content->footer .= '<br /><a href="' . $CFG->wwwroot . '/calendar/event.php?action=new&amp;course=' . $courseshown . '">' . get_string('newevent', 'calendar') . '</a>...';
         }
         if ($courseshown == SITEID) {
             // Being displayed at site level. This will cause the filter to fall back to auto-detecting
             // the list of courses it will be grabbing events from.
             $filtercourse = NULL;
             $groupeventsfrom = NULL;
             $SESSION->cal_courses_shown = calendar_get_default_courses(true);
             calendar_set_referring_course(0);
         } else {
             // Forcibly filter events to include only those from the particular course we are in.
             $filtercourse = array($courseshown => $COURSE);
             $groupeventsfrom = array($courseshown => 1);
         }
     }
     // We 'll need this later
     calendar_set_referring_course($courseshown);
     // Be VERY careful with the format for default courses arguments!
     // Correct formatting is [courseid] => 1 to be concise with moodlelib.php functions.
     calendar_set_filters($courses, $group, $user, $filtercourse, $groupeventsfrom, false);
     $events = calendar_get_upcoming($courses, $group, $user, get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS), get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS));
     if (!empty($this->instance)) {
         $this->content->text = calendar_get_sideblock_upcoming($events, 'view.php?view=day&amp;course=' . $courseshown . '&amp;');
     }
     if (empty($this->content->text)) {
         $this->content->text = '<div class="post">' . get_string('noupcomingevents', 'calendar') . '</div>';
     }
     return $this->content;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:52,代码来源:block_calendar_upcoming.php


示例18: check_login

 /**
  * Checks if username is set
  * 
  * @return boolean
  */
 public function check_login()
 {
     $username = get_user_preferences(self::USERNAME, '');
     if (empty($username)) {
         $username = optional_param('bitbucket_username', '', PARAM_ALPHANUM);
     }
     if ($username) {
         set_user_preference(self::USERNAME, $username);
         $this->client = new bitbucket($username);
         return true;
     }
     return false;
 }
开发者ID:robertboloc,项目名称:moodle-repository_bitbucket,代码行数:18,代码来源:lib.php


示例19: definition

 /**
  * Define the form.
  */
 public function definition()
 {
     global $COURSE;
     $mform = $this->_form;
     $mform->addElement('advcheckbox', 'enableactivitychooser', get_string('enableactivitychooser', 'admin'), get_string('configenableactivitychooser', 'admin'));
     $mform->setDefault('enableactivitychooser', get_user_preferences('usemodchooser', true, $this->_customdata['userid']));
     // Add some extra hidden fields.
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'course', $COURSE->id);
     $mform->setType('course', PARAM_INT);
     $this->add_action_buttons(true, get_string('savechanges'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:course_form.php


示例20: definition

 function definition()
 {
     global $USER, $CFG, $COURSE;
     $mform =& $this->_form;
     $mform->addElement('hidden', 'id', $USER->id);
     $mform->addElement('header', 'Editar', 'Editar Perfil');
     $mform->addElement('text', 'username', get_string('username'), array('readonly' => 'readonly'));
     $mform->setDefault('username', $USER->username);
     $mform->addRule('username', get_string('required'), 'required', '', 'client', false, false);
     $mform->addElement('text', 'firstname', get_string('firstname'), array('readonly' => 'readonly'));
     $mform->setDefault('firstname', $USER->firstname);
     $mform->addRule('firstname', get_string('required'), 'required', '', 'client', false, false);
     $mform->addElement('text', 'lastname', get_string('lastname'), array('readonly' => 'readonly'));
     $mform->setDefault('lastname', $USER->lastname);
     $mform->addRule('lastname', get_string('required'), 'required', '', 'client', false, false);
     $mform->addElement('password', 'pass1', get_string('newpassword'));
     $mform->addElement('password', 'pass2', get_string('newpassword') . ' (' . get_String('again') . ')');
     if (get_user_preferences('auth_forcepasswordchange')) {
         $mform->addRule('pass1', get_string('required'), 'required', '', 'client', false, false);
         $mform->addRule('pass2', get_string('required'), 'required', '', 'client', false, false);
     }
     $mform->addElement('text', 'email', 'Correo Banco');
     $mform->setDefault('email', $USER->email);
     $mform->addRule('email', get_string('required'), 'required', '', 'client', false, false);
     $mform->addRule('email', get_string('invalidemail'), 'email', '', 'client', false, false);
     $mform->addElement('text', 'msn', get_string('msnid'));
     $mform->setDefault('msn', $USER->msn);
     $mform->addRule('msn', get_string('required'), 'required', '', 'client', false, false);
     $mform->addRule('msn', get_string('invalidemail'), 'email', '', 'client', false, false);
     $mform->addElement('date_selector', 'icq', get_string('icqnumber'), array('startyear' => 1920, 'stopyear' => 2020, 'timezone' => 99, 'step' => 5));
     $mform->setDefault('icq', $USER->icq);
     $mform->addRule('icq', get_string('required'), 'required', '', 'client', false, false);
     $mform->addElement('text', 'phone1', get_string('phone'));
     $mform->setDefault('phone1', $USER->phone1);
     $mform->addRule('phone1', get_string('required'), 'required', '', 'client', false, false);
     $mform->addRule('phone1', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false);
     $mform->addElement('text', 'yahoo', get_string('yahooid'));
     $mform->setDefault('yahoo', $USER->yahoo);
     // $mform->addRule('yahoo', get_string('required'), 'required', '', 'client', false, false);
     $mform->addRule('yahoo', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false);
     $mform->addElement('text', 'phone2', get_string('phone2'));
     $mform->setDefault('phone2', $USER->phone2);
     //$mform->addRule('phone2', get_string('required'), 'required', '', 'client', false, false);
     $mform->addRule('phone2', get_string('isnumber', 'report_user'), 'numeric', '', 'client', false, false);
     $mform->addElement('html', '<div><span class="msg-picture">Recuerda que esta imagen ser&aacute; vista por tus compa&ntilde;eros.</span></div>');
     $mform->addElement('file', 'picture', get_string('userpic'));
     $mform->addElement('submit', 'save', get_string('savechanges'));
     $mform->addElement('html', '<div style="color:#A00" align="right">En caso no cuente con correo BCP ingrese un correo personal**</div>');
 }
开发者ID:etarrillo,项目名称:pvflbl,代码行数:49,代码来源:user_form.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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