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


PHP get_user_preferences函数代码示例

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


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


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