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


PHP get_list_of_timezones函数代码示例

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


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

示例1: definition

 /**
  * Defines forms elements
  */
 public function definition()
 {
     global $USER, $CFG;
     $mform = $this->_form;
     $mform->addElement('hidden', 'sessionid');
     $mform->setType('sessionid', PARAM_INT);
     // Adding the "general" fieldset, where all the common settings are showed.
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Adding the standard "name" field.
     $mform->addElement('text', 'name', get_string('collaboratename', 'collaborate'), array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     // Adding the standard "intro" and "introformat" fields. Note has to be required as description is required by
     // API.
     $this->add_intro_editor(true);
     $time = time();
     // Round time up if necessary.
     $minutes = date('i', $time);
     if ($minutes >= 30) {
         $time += (60 - $minutes) * 60;
     }
     // Remove minutes.
     $time = strtotime(date('Y-m-d H:0', $time));
     // Get timezone to show against start time label.
     $tzones = get_list_of_timezones();
     if (isset($tzones[$USER->timezone])) {
         $tzone = $tzones[$USER->timezone];
     } else {
         $tzone = $tzones[date_default_timezone_get()];
     }
     $tzonestr = ' (' . get_string('timezone', 'mod_collaborate', $tzone) . ')';
     // Start Time.
     $mform->addElement('date_time_selector', 'timestart', get_string('sessionstart', 'mod_collaborate') . $tzonestr);
     $mform->setDefault('timestart', $time);
     $mform->addElement('static', 'sessionstarthelp', '', get_string('sessionstarthelp', 'mod_collaborate'));
     $options = [HOURSECS * 0.5 => get_string('minutes', 'mod_collaborate', '30'), HOURSECS => get_string('hour', 'mod_collaborate'), HOURSECS * 1.5 => get_string('hourminutes', 'mod_collaborate', (object) ['hours' => 1, 'minutes' => 30]), HOURSECS * 2 => get_string('hours', 'mod_collaborate', 2), HOURSECS * 2.5 => get_string('hoursminutes', 'mod_collaborate', (object) ['hours' => 2, 'minutes' => 30]), 9999 => get_string('openended', 'mod_collaborate')];
     $mform->addElement('select', 'duration', get_string('duration', 'mod_collaborate'), $options);
     $mform->setDefault('duration', HOURSECS);
     // Add standard grading elements.
     $this->standard_grading_coursemodule_elements();
     // Add standard elements, common to all modules.
     $this->standard_coursemodule_elements();
     // Add standard buttons, common to all modules.
     $this->add_action_buttons();
 }
开发者ID:mpetrowi,项目名称:moodle-mod_collaborate,代码行数:53,代码来源:mod_form.php

示例2: test_get_list_of_timezones

 public function test_get_list_of_timezones()
 {
     // Use timezones that are not problematic, this way we may test before
     // and after the big tz rewrite.
     $list = get_list_of_timezones();
     $this->assertDebuggingCalled();
     $this->assertArrayHasKey('Europe/London', $list);
     $this->assertArrayHasKey('Pacific/Auckland', $list);
     $this->assertArrayHasKey('America/New_York', $list);
     $this->assertArrayHasKey('Europe/Berlin', $list);
     $this->assertArrayHasKey('Europe/Prague', $list);
     $this->assertArrayHasKey('Australia/Perth', $list);
     $this->assertArrayHasKey('Australia/Lord_Howe', $list);
 }
开发者ID:Keneth1212,项目名称:moodle,代码行数:14,代码来源:date_legacy_test.php

示例3: admin_settingpage

<?php

// $Id$
// "locations" settingpage
$temp = new admin_settingpage('locationsettings', get_string('locationsettings', 'admin'));
$options = get_list_of_timezones();
$options[99] = get_string('serverlocaltime');
$temp->add(new admin_setting_configselect('timezone', get_string('timezone', 'admin'), get_string('configtimezone', 'admin'), 99, $options));
$options[99] = get_string('timezonenotforced', 'admin');
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
$options = get_list_of_countries();
$options[0] = get_string('choose') . '...';
$temp->add(new admin_setting_configselect('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0, $options));
$iplookups = array();
if ($plugins = get_list_of_plugins('iplookup')) {
    foreach ($plugins as $plugin) {
        $iplookups[$plugin] = $plugin;
    }
}
$temp->add(new admin_setting_configselect('iplookup', get_string('iplookup', 'admin'), get_string('configiplookup', 'admin'), 'hostip', $iplookups));
$ADMIN->add('location', $temp);
$ADMIN->add('location', new admin_externalpage('timezoneimport', get_string('updatetimezones', 'admin'), "{$CFG->wwwroot}/{$CFG->admin}/timezoneimport.php"));
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:22,代码来源:location.php

示例4: useredit_shared_definition


//.........这里部分代码省略.........
        $mform->setDefault('htmleditor', 1);
    } else {
        $mform->addElement('hidden', 'htmleditor');
        $mform->setDefault('htmleditor', 1);
        $mform->setType('htmleditor', PARAM_INT);
    }
    if (empty($CFG->enableajax)) {
        $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
    } else {
        $choices = array();
        $choices['0'] = get_string('ajaxno');
        $choices['1'] = get_string('ajaxyes');
        $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
        $mform->setDefault('ajax', 0);
    }
    $choices = array();
    $choices['0'] = get_string('screenreaderno');
    $choices['1'] = get_string('screenreaderyes');
    $mform->addElement('select', 'screenreader', get_string('screenreaderuse'), $choices);
    $mform->setDefault('screenreader', 0);
    $mform->addHelpButton('screenreader', 'screenreaderuse');
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
    $mform->setType('city', PARAM_MULTILANG);
    $mform->addRule('city', $strrequired, 'required', null, 'client');
    if (!empty($CFG->defaultcity)) {
        $mform->setDefault('city', $CFG->defaultcity);
    }
    $choices = get_string_manager()->get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    $mform->addRule('country', $strrequired, 'required', null, 'client');
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
    if ($CFG->forcetimezone != 99) {
        $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]);
    } else {
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', '99');
    }
    $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
    $mform->setDefault('lang', $CFG->lang);
    if (!empty($CFG->allowuserthemes)) {
        $choices = array();
        $choices[''] = get_string('default');
        $themes = get_list_of_themes();
        foreach ($themes as $key => $theme) {
            if (empty($theme->hidefromselector)) {
                $choices[$key] = $theme->name;
            }
        }
        $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
    }
    $mform->addElement('editor', 'description_editor', get_string('userdescription'), null, $editoroptions);
    $mform->setType('description_editor', PARAM_CLEANHTML);
    $mform->addHelpButton('description_editor', 'userdescription');
    if (!empty($CFG->gdversion) and empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_picture', get_string('pictureofuser'));
        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', 0);
        $mform->addElement('filepicker', 'imagefile', get_string('newpicture'), '', array('maxbytes' => get_max_upload_file_size($CFG->maxbytes)));
        $mform->addHelpButton('imagefile', 'newpicture');
        $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
        $mform->setType('imagealt', PARAM_MULTILANG);
    }
    if (!empty($CFG->usetags) and empty($USER->newadminuser)) {
        $mform->addElement('header', 'moodle_interests', get_string('interests'));
        $mform->addElement('tags', 'interests', get_string('interestslist'), array('display' => 'noofficial'));
        $mform->addHelpButton('interests', 'interestslist');
    }
    /// Moodle optional fields
    $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
    $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
    $mform->setType('url', PARAM_URL);
    $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
    $mform->setType('icq', PARAM_NOTAGS);
    $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
    $mform->setType('skype', PARAM_NOTAGS);
    $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
    $mform->setType('aim', PARAM_NOTAGS);
    $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
    $mform->setType('yahoo', PARAM_NOTAGS);
    $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
    $mform->setType('msn', PARAM_NOTAGS);
    $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
    $mform->setType('idnumber', PARAM_NOTAGS);
    $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
    $mform->setType('institution', PARAM_MULTILANG);
    $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
    $mform->setType('department', PARAM_MULTILANG);
    $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
    $mform->setType('phone1', PARAM_NOTAGS);
    $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
    $mform->setType('phone2', PARAM_NOTAGS);
    $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
    $mform->setType('address', PARAM_MULTILANG);
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:editlib.php

示例5: definition

 public function definition()
 {
     global $USER, $CFG, $COURSE;
     $mform =& $this->_form;
     $templateuser = $USER;
     $context = $this->_customdata['context'];
     $mform->addElement('header', 'settingsheader', get_string('toolsettings', 'local_ltiprovider'));
     $tools = array();
     $tools[$context->id] = get_string('course');
     $modinfo = get_fast_modinfo($this->_customdata['courseid']);
     $mods = $modinfo->get_cms();
     foreach ($mods as $mod) {
         $tools[$mod->context->id] = format_string($mod->name);
     }
     $mform->addElement('select', 'contextid', get_string('tooltobeprovide', 'local_ltiprovider'), $tools);
     $mform->setDefault('contextid', $context->id);
     $mform->addElement('checkbox', 'sendgrades', null, get_string('sendgrades', 'local_ltiprovider'));
     $mform->setDefault('sendgrades', 1);
     $mform->addElement('checkbox', 'forcenavigation', null, get_string('forcenavigation', 'local_ltiprovider'));
     $mform->setDefault('forcenavigation', 1);
     $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'local_ltiprovider'), array('optional' => true, 'defaultunit' => 86400));
     $mform->setDefault('enrolperiod', 0);
     $mform->addHelpButton('enrolperiod', 'enrolperiod', 'local_ltiprovider');
     $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'local_ltiprovider'), array('optional' => true));
     $mform->setDefault('enrolstartdate', 0);
     $mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'local_ltiprovider');
     $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'local_ltiprovider'), array('optional' => true));
     $mform->setDefault('enrolenddate', 0);
     $mform->addHelpButton('enrolenddate', 'enrolenddate', 'local_ltiprovider');
     $mform->addElement('text', 'maxenrolled', get_string('maxenrolled', 'local_ltiprovider'));
     $mform->setDefault('maxenrolled', 0);
     $mform->addHelpButton('maxenrolled', 'maxenrolled', 'local_ltiprovider');
     $mform->setType('maxenrolled', PARAM_INT);
     $assignableroles = get_assignable_roles($context);
     $mform->addElement('select', 'croleinst', get_string('courseroleinstructor', 'local_ltiprovider'), $assignableroles);
     $mform->setDefault('croleinst', '3');
     $mform->setAdvanced('croleinst');
     $mform->addElement('select', 'crolelearn', get_string('courserolelearner', 'local_ltiprovider'), $assignableroles);
     $mform->setDefault('crolelearn', '5');
     $mform->setAdvanced('crolelearn');
     $mform->addElement('select', 'aroleinst', get_string('activityroleinstructor', 'local_ltiprovider'), $assignableroles);
     $mform->disabledIf('aroleinst', 'contextid', 'eq', $context->id);
     $mform->setDefault('aroleinst', '3');
     $mform->setAdvanced('aroleinst');
     $mform->addElement('select', 'arolelearn', get_string('activityrolelearner', 'local_ltiprovider'), $assignableroles);
     $mform->disabledIf('arolelearn', 'contextid', 'eq', $context->id);
     $mform->setDefault('arolelearn', '5');
     $mform->setAdvanced('arolelearn');
     $mform->addElement('header', 'remotesystem', get_string('remotesystem', 'local_ltiprovider'));
     $mform->addElement('text', 'secret', get_string('secret', 'local_ltiprovider'), 'maxlength="64" size="25"');
     $mform->setType('secret', PARAM_MULTILANG);
     $mform->setDefault('secret', md5(uniqid(rand(), 1)));
     $mform->addRule('secret', get_string('required'), 'required');
     if (class_exists('textlib')) {
         $textlib = new textlib();
     } else {
         try {
             // for older moodle instances
             $textlib = textlib_get_instance();
         } catch (Exception $e) {
             // updated to use new core_text lib as required by Moodle 2.9
             $textlib = new core_text();
         }
     }
     $choices = $textlib->get_encodings();
     $mform->addElement('select', 'encoding', get_string('remoteencoding', 'local_ltiprovider'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $mform->addElement('header', 'defaultheader', get_string('userdefaultvalues', 'local_ltiprovider'));
     $choices = array(0 => get_string('never'), 1 => get_string('always'));
     $mform->addElement('select', 'userprofileupdate', get_string('userprofileupdate', 'local_ltiprovider'), $choices);
     $userprofileupdate = get_config('local_ltiprovider', 'userprofileupdate');
     if ($userprofileupdate != -1) {
         $mform->setDefault('userprofileupdate', $userprofileupdate);
         $mform->freeze('userprofileupdate');
     } else {
         $mform->setDefault('userprofileupdate', 1);
     }
     $choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
     $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
     $mform->setDefault('maildisplay', 2);
     $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
     $mform->setType('city', PARAM_MULTILANG);
     if (empty($CFG->defaultcity)) {
         $mform->setDefault('city', $templateuser->city);
     } else {
         $mform->setDefault('city', $CFG->defaultcity);
     }
     $mform->addRule('city', get_string('required'), 'required');
     $mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
     if (empty($CFG->country)) {
         $mform->setDefault('country', $templateuser->country);
     } else {
         $mform->setDefault('country', $CFG->country);
     }
     $mform->setAdvanced('country');
     $choices = get_list_of_timezones();
     $choices['99'] = get_string('serverlocaltime');
     $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
     $mform->setDefault('timezone', $templateuser->timezone);
     $mform->setAdvanced('timezone');
//.........这里部分代码省略.........
开发者ID:jellisii,项目名称:moodle-local_ltiprovider,代码行数:101,代码来源:edit_form.php

示例6: definition


//.........这里部分代码省略.........
                     $mform->setDefault('uulegacy3', $role->id);
                     break;
                 }
             }
             unset($teacherroles);
         }
     }
     // default values
     $mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'tool_uploaduser'));
     $mform->addElement('text', 'username', get_string('uuusernametemplate', 'tool_uploaduser'), 'size="20"');
     $mform->setType('username', PARAM_RAW);
     // No cleaning here. The process verifies it later.
     $mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client');
     $mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE);
     $mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE);
     $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
     $mform->setType('email', PARAM_RAW);
     // No cleaning here. The process verifies it later.
     $mform->disabledIf('email', 'uutype', 'eq', UU_USER_ADD_UPDATE);
     $mform->disabledIf('email', 'uutype', 'eq', UU_USER_UPDATE);
     // only enabled and known to work plugins
     $choices = uu_supported_auths();
     $mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $choices);
     $mform->setDefault('auth', 'manual');
     // manual is a sensible backwards compatible default
     $mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
     $mform->setAdvanced('auth');
     $choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
     $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
     $mform->setDefault('maildisplay', 2);
     $choices = array(0 => get_string('textformat'), 1 => get_string('htmlformat'));
     $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
     $mform->setDefault('mailformat', 1);
     $mform->setAdvanced('mailformat');
     $choices = array(0 => get_string('emaildigestoff'), 1 => get_string('emaildigestcomplete'), 2 => get_string('emaildigestsubjects'));
     $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
     $mform->setDefault('maildigest', 0);
     $mform->setAdvanced('maildigest');
     $choices = array(1 => get_string('autosubscribeyes'), 0 => get_string('autosubscribeno'));
     $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
     $mform->setDefault('autosubscribe', 1);
     $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="25"');
     $mform->setType('city', PARAM_TEXT);
     if (empty($CFG->defaultcity)) {
         $mform->setDefault('city', $templateuser->city);
     } else {
         $mform->setDefault('city', $CFG->defaultcity);
     }
     $choices = get_string_manager()->get_list_of_countries();
     $choices = array('' => get_string('selectacountry') . '...') + $choices;
     $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
     if (empty($CFG->country)) {
         $mform->setDefault('country', $templateuser->country);
     } else {
         $mform->setDefault('country', $CFG->country);
     }
     $mform->setAdvanced('country');
     $choices = get_list_of_timezones();
     $choices['99'] = get_string('serverlocaltime');
     $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
     $mform->setDefault('timezone', $templateuser->timezone);
     $mform->setAdvanced('timezone');
     $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
     $mform->setDefault('lang', $templateuser->lang);
     $mform->setAdvanced('lang');
     $editoroptions = array('maxfiles' => 0, 'maxbytes' => 0, 'trusttext' => false, 'forcehttps' => false);
     $mform->addElement('editor', 'description', get_string('userdescription'), null, $editoroptions);
     $mform->setType('description', PARAM_CLEANHTML);
     $mform->addHelpButton('description', 'userdescription');
     $mform->setAdvanced('description');
     $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
     $mform->setType('url', PARAM_URL);
     $mform->setAdvanced('url');
     $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
     $mform->setType('idnumber', PARAM_NOTAGS);
     $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"');
     $mform->setType('institution', PARAM_TEXT);
     $mform->setDefault('institution', $templateuser->institution);
     $mform->addElement('text', 'department', get_string('department'), 'maxlength="255" size="25"');
     $mform->setType('department', PARAM_TEXT);
     $mform->setDefault('department', $templateuser->department);
     $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
     $mform->setType('phone1', PARAM_NOTAGS);
     $mform->setAdvanced('phone1');
     $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
     $mform->setType('phone2', PARAM_NOTAGS);
     $mform->setAdvanced('phone2');
     $mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
     $mform->setType('address', PARAM_TEXT);
     $mform->setAdvanced('address');
     // Next the profile defaults
     profile_definition($mform);
     // hidden fields
     $mform->addElement('hidden', 'iid');
     $mform->setType('iid', PARAM_INT);
     $mform->addElement('hidden', 'previewrows');
     $mform->setType('previewrows', PARAM_INT);
     $this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
     $this->set_data($data);
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:101,代码来源:user_form.php

示例7: useredit_shared_definition

function useredit_shared_definition(&$mform, $editoroptions = null, $filemanageroptions = null)
{
    global $CFG, $USER, $DB;
    $user = $DB->get_record('user', array('id' => $USER->id));
    useredit_load_preferences($user, false);
    $strrequired = get_string('required');
    // Add the necessary names.
    foreach (useredit_get_required_name_fields() as $fullname) {
        $mform->addElement('text', $fullname, get_string($fullname), 'maxlength="100" size="30"');
        $mform->addRule($fullname, $strrequired, 'required', null, 'client');
        $mform->setType($fullname, PARAM_NOTAGS);
    }
    $enabledusernamefields = useredit_get_enabled_name_fields();
    // Add the enabled additional name fields.
    foreach ($enabledusernamefields as $addname) {
        $mform->addElement('text', $addname, get_string($addname), 'maxlength="100" size="30"');
        $mform->setType($addname, PARAM_NOTAGS);
    }
    // Do not show email field if change confirmation is pending
    if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) {
        $notice = get_string('emailchangepending', 'auth', $user);
        $notice .= '<br /><a href="edit.php?cancelemailchange=1&amp;id=' . $user->id . '">' . get_string('emailchangecancel', 'auth') . '</a>';
        $mform->addElement('static', 'emailpending', get_string('email'), $notice);
    } else {
        $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
        $mform->addRule('email', $strrequired, 'required', null, 'client');
        $mform->setType('email', PARAM_EMAIL);
    }
    $choices = array();
    $choices['0'] = get_string('emaildisplayno');
    $choices['1'] = get_string('emaildisplayyes');
    $choices['2'] = get_string('emaildisplaycourse');
    $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
    $mform->setDefault('maildisplay', 2);
    $choices = array();
    $choices['0'] = get_string('textformat');
    $choices['1'] = get_string('htmlformat');
    $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
    $mform->setDefault('mailformat', 1);
    if (!empty($CFG->allowusermailcharset)) {
        $choices = array();
        $charsets = get_list_of_charsets();
        if (!empty($CFG->sitemailcharset)) {
            $choices['0'] = get_string('site') . ' (' . $CFG->sitemailcharset . ')';
        } else {
            $choices['0'] = get_string('site') . ' (UTF-8)';
        }
        $choices = array_merge($choices, $charsets);
        $mform->addElement('select', 'preference_mailcharset', get_string('emailcharset'), $choices);
    }
    $choices = array();
    $choices['0'] = get_string('emaildigestoff');
    $choices['1'] = get_string('emaildigestcomplete');
    $choices['2'] = get_string('emaildigestsubjects');
    $mform->addElement('select', 'maildigest', get_string('emaildigest'), $choices);
    $mform->setDefault('maildigest', 0);
    $mform->addHelpButton('maildigest', 'emaildigest');
    $choices = array();
    $choices['1'] = get_string('autosubscribeyes');
    $choices['0'] = get_string('autosubscribeno');
    $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
    $mform->setDefault('autosubscribe', 1);
    if (!empty($CFG->forum_trackreadposts)) {
        $choices = array();
        $choices['0'] = get_string('trackforumsno');
        $choices['1'] = get_string('trackforumsyes');
        $mform->addElement('select', 'trackforums', get_string('trackforums'), $choices);
        $mform->setDefault('trackforums', 0);
    }
    $editors = editors_get_enabled();
    if (count($editors) > 1) {
        $choices = array('' => get_string('defaulteditor'));
        $firsteditor = '';
        foreach (array_keys($editors) as $editor) {
            if (!$firsteditor) {
                $firsteditor = $editor;
            }
            $choices[$editor] = get_string('pluginname', 'editor_' . $editor);
        }
        $mform->addElement('select', 'preference_htmleditor', get_string('textediting'), $choices);
        $mform->setDefault('preference_htmleditor', '');
    } else {
        // Empty string means use the first chosen text editor.
        $mform->addElement('hidden', 'preference_htmleditor');
        $mform->setDefault('preference_htmleditor', '');
        $mform->setType('preference_htmleditor', PARAM_PLUGIN);
    }
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="21"');
    $mform->setType('city', PARAM_TEXT);
    if (!empty($CFG->defaultcity)) {
        $mform->setDefault('city', $CFG->defaultcity);
    }
    $choices = get_string_manager()->get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
//.........这里部分代码省略.........
开发者ID:helenagarcia90,项目名称:moodle,代码行数:101,代码来源:editlib.php

示例8: definition

 function definition()
 {
     global $PAGE;
     require_js_files();
     $mform =& $this->_form;
     $page = $this->_customdata;
     $workflow = $page->workflow;
     // Get the workflow data for the timezone to keep the time_selector in line
     $workflowdata = $workflow->unserialize_data(array());
     $mform->addElement('html', '');
     // Add javascript function to toggle the simple/recurring calendar elements
     // Also add a listener to show/hide the simple/calendar elements on page load
     $mform->addElement('html', '<script type="text/javascript">
         function switchCalendar() {
             var showHide = document.getElementsByName("recurrencetype");
             var simple = document.getElementById("id_simplerecurrencegroup");
             var calendar = document.getElementById("id_calendarrecurrencegroup");
             var simplestate = simple.className.indexOf("collapsed") >= 0 ? "collapsed" : "";
             var calendarstate = calendar.className.indexOf("collapsed") >= 0 ? "collapsed" : "";
             if (showHide["0"].checked) {
                 if(showHide["0"].value == \'calendar\')
                 {
                     simple.className = "accesshide collapsible "+simplestate;
                     calendar.className = "clearfix collapsible "+calendarstate;
                 }
                 else
                 {
                     simple.className = "clearfix collapsible "+simplestate;
                     calendar.className = "accesshide collapsible "+calendarstate;
                 }
             }
             else
                 if(showHide["0"].value == \'simple\')
                 {
                     simple.className = "accesshide collapsible "+simplestate;
                     calendar.className = "clearfix collapsible "+calendarstate;
                 }
                 else
                 {
                     simple.className = "clearfix collapsible "+simplestate;
                     calendar.className = "accesshide collapsible "+calendarstate;
                 }
         }
     function initCalendar() {
         YUI().use("yui2-event", function(Y) {
             var YAHOO = Y.YUI2;
             YAHOO.util.Event.onDOMReady(switchCalendar());
         });
     }
     YUI().use("yui2-event", function(Y) {
         var YAHOO = Y.YUI2;
         YAHOO.util.Event.onDOMReady(initCalendar);
     });
     </script>');
     $mform->addElement('hidden', '_wfid', $workflow->id);
     $mform->setType('_wfid', PARAM_INT);
     $mform->addElement('hidden', '_step', scheduling_workflow::STEP_SCHEDULE);
     $mform->setType('_step', PARAM_TEXT);
     $mform->addElement('hidden', 'action', 'save');
     $mform->setType('action', PARAM_TEXT);
     $mform->addElement('html', '<h2>' . htmlspecialchars(get_string('recurrence_description', 'local_elisreports')) . '</h2>');
     $choices = get_list_of_timezones();
     $choices['99'] = get_string('serverlocaltime');
     $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
     $mform->setDefault('timezone', 99);
     $group = array();
     $group[] = $mform->createElement('radio', 'starttype', '', get_string('now', 'local_elisreports'), 0);
     // Add onclick action to toggle the calendar
     $mform->_attributes['onclick'] = 'switchCalendar();';
     $group[] = $mform->createElement('radio', 'starttype', '', get_string('time_on', 'local_elisreports'), 1);
     // Add onclick action to toggle the calendar
     $mform->_attributes['onclick'] = 'switchCalendar();';
     //Set date options: timezone = 0 so it doesn't adjust the time ...
     $date_options = array('timezone' => 0, 'optional' => false, 'startyear' => userdate(time(), '%Y', -13, false), 'stopyear' => 2038, 'applydst' => false);
     $group[] = $mform->createElement('date_selector', 'startdate', '', $date_options);
     $mform->addGroup($group, 'starttype', get_string('start', 'local_elisreports'), '', false);
     $mform->setDefault('starttype', 0);
     $mform->addRule('starttype', get_string('required_field', 'local_elisreports', get_string('start', 'local_elisreports')), 'required', null, 'client');
     $mform->disabledIf('startdate', 'starttype', 'neq', 1);
     $mform->disabledIf('startdate[day]', 'starttype', 'neq', 1);
     $mform->disabledIf('startdate[month]', 'starttype', 'neq', 1);
     $mform->disabledIf('startdate[year]', 'starttype', 'neq', 1);
     $group = array();
     $group[] = $mform->createElement('radio', 'recurrencetype', '', get_string('simple_recurrence', 'local_elisreports'), scheduling_workflow::RECURRENCE_SIMPLE);
     $group[] = $mform->createElement('radio', 'recurrencetype', '', get_string('calendar_recurrence', 'local_elisreports'), scheduling_workflow::RECURRENCE_CALENDAR);
     $mform->addGroup($group, 'recurrencetype', get_string('recurrence', 'local_elisreports'), '', false);
     $mform->setDefault('recurrencetype', scheduling_workflow::RECURRENCE_SIMPLE);
     $mform->addRule('recurrencetype', get_string('required_field', 'local_elisreports', get_string('recurrence', 'local_elisreports')), 'required', null, 'client');
     $mform->addElement('header', 'simplerecurrencegroup', get_string('simple_recurrence_settings', 'local_elisreports'));
     $group = array();
     $group[] = $mform->createElement('radio', 'runtype', '', get_string('indefinitely', 'local_elisreports'), 0);
     $group[] = $mform->createElement('static', '', '', '<br />');
     $group[] = $mform->createElement('radio', 'runtype', '', get_string('until', 'local_elisreports'), 1);
     $group[] = $mform->createElement('date_selector', 'enddate', '', $date_options);
     $group[] = $mform->createElement('static', '', '', '<br />');
     $group[] = $mform->createElement('radio', 'runtype', '', '', 2);
     $group[] = $mform->createElement('text', 'runsremaining', '', array('size' => 2));
     $group[] = $mform->createElement('static', '', '', get_string('times', 'local_elisreports'));
     $group[] = $mform->createElement('static', '', '', '<br />&nbsp;&nbsp;&nbsp;&nbsp;' . get_string('every', 'local_elisreports'));
     $group[] = $mform->createElement('text', 'frequency', '', array('size' => 2));
//.........这里部分代码省略.........
开发者ID:jamesmcq,项目名称:elis,代码行数:101,代码来源:scheduling.php

示例9: useredit_shared_definition


//.........这里部分代码省略.........
    }
    if ($CFG->htmleditor) {
        $choices = array();
        $choices['0'] = get_string('texteditor');
        $choices['1'] = get_string('htmleditor');
        $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
        $mform->setDefault('htmleditor', 1);
        $mform->setAdvanced('htmleditor');
    }
    if (empty($CFG->enableajax)) {
        $mform->addElement('static', 'ajaxdisabled', get_string('ajaxuse'), get_string('ajaxno'));
        $mform->setAdvanced('ajaxdisabled');
    } else {
        $choices = array();
        $choices['0'] = get_string('ajaxno');
        $choices['1'] = get_string('ajaxyes');
        $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
        $mform->setDefault('ajax', 0);
        $mform->setAdvanced('ajax');
    }
    $choices = array();
    $choices['0'] = get_string('screenreaderno');
    $choices['1'] = get_string('screenreaderyes');
    $mform->addElement('select', 'screenreader', get_string('screenreaderuse'), $choices);
    $mform->setDefault('screenreader', 0);
    $mform->setAdvanced('screenreader');
    $mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="21"');
    $mform->setType('city', PARAM_MULTILANG);
    $mform->addRule('city', $strrequired, 'required', null, 'client');
    $choices = get_list_of_countries();
    $choices = array('' => get_string('selectacountry') . '...') + $choices;
    $mform->addElement('select', 'country', get_string('selectacountry'), $choices);
    $mform->addRule('country', $strrequired, 'required', null, 'client');
    if (!empty($CFG->country)) {
        $mform->setDefault('country', $CFG->country);
    }
    $choices = get_list_of_timezones();
    $choices['99'] = get_string('serverlocaltime');
    if ($CFG->forcetimezone != 99) {
        $mform->addElement('static', 'forcedtimezone', get_string('timezone'), $choices[$CFG->forcetimezone]);
    } else {
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', '99');
    }
    $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
    $mform->setDefault('lang', $CFG->lang);
    if (!empty($CFG->allowuserthemes)) {
        $choices = array();
        $choices[''] = get_string('default');
        $choices += get_list_of_themes();
        $mform->addElement('select', 'theme', get_string('preferredtheme'), $choices);
        $mform->setAdvanced('theme');
    }
    $mform->addElement('htmleditor', 'description', get_string('userdescription'));
    $mform->setType('description', PARAM_CLEAN);
    $mform->setHelpButton('description', array('text', get_string('helptext')));
    if (!empty($CFG->gdversion)) {
        $mform->addElement('header', 'moodle_picture', get_string('pictureof'));
        //TODO: Accessibility fix fieldset legend
        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', false);
        $mform->addElement('file', 'imagefile', get_string('newpicture'));
        $mform->setHelpButton('imagefile', array('picture', get_string('helppicture')));
        $mform->addElement('text', 'imagealt', get_string('imagealt'), 'maxlength="100" size="30"');
        $mform->setType('imagealt', PARAM_MULTILANG);
    }
    if (!empty($CFG->usetags)) {
        $mform->addElement('header', 'moodle_interests', get_string('interests'));
        $mform->addElement('textarea', 'interests', get_string('interestslist'), 'cols="45" rows="3"');
        $mform->setHelpButton('interests', array('interestslist', get_string('helpinterestslist'), false, true, false));
    }
    /// Moodle optional fields
    $mform->addElement('header', 'moodle_optional', get_string('optional', 'form'));
    $mform->setAdvanced('moodle_optional');
    $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
    $mform->setType('url', PARAM_URL);
    $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
    $mform->setType('icq', PARAM_CLEAN);
    $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
    $mform->setType('skype', PARAM_CLEAN);
    $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
    $mform->setType('aim', PARAM_CLEAN);
    $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
    $mform->setType('yahoo', PARAM_CLEAN);
    $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
    $mform->setType('msn', PARAM_CLEAN);
    $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
    $mform->setType('idnumber', PARAM_CLEAN);
    $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
    $mform->setType('institution', PARAM_MULTILANG);
    $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
    $mform->setType('department', PARAM_MULTILANG);
    $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
    $mform->setType('phone1', PARAM_CLEAN);
    $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
    $mform->setType('phone2', PARAM_CLEAN);
    $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
    $mform->setType('address', PARAM_MULTILANG);
}
开发者ID:r007,项目名称:PMoodle,代码行数:101,代码来源:editlib.php

示例10: optional_param

<?php

// $Id: timezone.php,v 1.7 2007/01/03 01:53:52 vyshane Exp $
require_once '../config.php';
$zone = optional_param('zone', '', PARAM_PATH);
//not a path, but it looks like it anyway
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
$strtimezone = get_string("timezone");
$strsavechanges = get_string("savechanges");
$strusers = get_string("users");
$strall = get_string("all");
print_header($strtimezone, $strtimezone, $strtimezone);
print_heading("");
if (!empty($zone) and confirm_sesskey()) {
    $db->debug = true;
    echo "<center>";
    execute_sql("UPDATE {$CFG->prefix}user SET timezone = '{$zone}'");
    $db->debug = false;
    echo "</center>";
    $USER->timezone = $zone;
}
require_once $CFG->dirroot . '/calendar/lib.php';
$timezones = get_list_of_timezones();
echo '<center><form action="timezone.php" method="get">';
echo "{$strusers} ({$strall}): ";
choose_from_menu($timezones, "zone", 99, get_string("serverlocaltime"), "", "99");
echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />";
echo "<input type=\"submit\" value=\"{$strsavechanges}\" />";
echo "</form></center>";
print_footer();
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:timezone.php

示例11: definition

    public function definition() {
        global $USER, $CFG, $COURSE;

        $mform = & $this->_form;
        $templateuser = $USER;
        $context = $this->_customdata['context'];

        $mform->addElement('header', 'settingsheader', get_string('toolsettings', 'local_ltiprovider'));

        $tools = array();
        $tools[$context->id] = get_string('course');
        get_all_mods($this->_customdata['courseid'], $mods, $modnames, $modnamesplural, $modnamesused);

        foreach ($mods as $mod) {
            $tools[$mod->context->id] = format_string($mod->name);
        }

        $mform->addElement('select', 'contextid', get_string('tooltobeprovide', 'local_ltiprovider'), $tools);
        $mform->setDefault('contextid', $context->id);

        $mform->addElement('checkbox', 'sendgrades', null, get_string('sendgrades', 'local_ltiprovider'));
        $mform->setDefault('sendgrades', 1);

        $mform->addElement('checkbox', 'forcenavigation', null, get_string('forcenavigation', 'local_ltiprovider'));
        $mform->setDefault('forcenavigation', 1);

        $mform->addElement('duration', 'enrolperiod', get_string('enrolperiod', 'local_ltiprovider'), array('optional' => true, 'defaultunit' => 86400));
        $mform->setDefault('enrolperiod', 0);
        $mform->addHelpButton('enrolperiod', 'enrolperiod', 'local_ltiprovider');

        $mform->addElement('date_selector', 'enrolstartdate', get_string('enrolstartdate', 'local_ltiprovider'), array('optional' => true));
        $mform->setDefault('enrolstartdate', 0);
        $mform->addHelpButton('enrolstartdate', 'enrolstartdate', 'local_ltiprovider');

        $mform->addElement('date_selector', 'enrolenddate', get_string('enrolenddate', 'local_ltiprovider'), array('optional' => true));
        $mform->setDefault('enrolenddate', 0);
        $mform->addHelpButton('enrolenddate', 'enrolenddate', 'local_ltiprovider');

        $mform->addElement('text', 'maxenrolled', get_string('maxenrolled', 'local_ltiprovider'));
        $mform->setDefault('maxenrolled', 0);
        $mform->addHelpButton('maxenrolled', 'maxenrolled', 'local_ltiprovider');
        $mform->setType('maxenrolled', PARAM_INT);

        $assignableroles = get_assignable_roles($context);

        $mform->addElement('select', 'croleinst', get_string('courseroleinstructor', 'local_ltiprovider'), $assignableroles);
        $mform->setDefault('croleinst', '3');
        $mform->setAdvanced('croleinst');
        $mform->addElement('select', 'crolelearn', get_string('courserolelearner', 'local_ltiprovider'), $assignableroles);
        $mform->setDefault('crolelearn', '5');
        $mform->setAdvanced('crolelearn');

        $mform->addElement('select', 'aroleinst', get_string('activityroleinstructor', 'local_ltiprovider'), $assignableroles);
        $mform->disabledIf('aroleinst', 'contextid', 'eq', $context->id);
        $mform->setDefault('aroleinst', '3');
        $mform->setAdvanced('aroleinst');
        $mform->addElement('select', 'arolelearn', get_string('activityrolelearner', 'local_ltiprovider'), $assignableroles);
        $mform->disabledIf('arolelearn', 'contextid', 'eq', $context->id);
        $mform->setDefault('arolelearn', '5');
        $mform->setAdvanced('arolelearn');

        $mform->addElement('header', 'remotesystem', get_string('remotesystem', 'local_ltiprovider'));

        $mform->addElement('text', 'secret', get_string('secret', 'local_ltiprovider'), 'maxlength="64" size="25"');
        $mform->setType('secret', PARAM_MULTILANG);
        $mform->setDefault('secret', md5(uniqid(rand(), 1)));
        $mform->addRule('secret', get_string('required'), 'required');

        $textlib = textlib_get_instance();
        $choices = $textlib->get_encodings();
        $mform->addElement('select', 'encoding', get_string('remoteencoding', 'local_ltiprovider'), $choices);
        $mform->setDefault('encoding', 'UTF-8');

        $mform->addElement('header', 'defaultheader', get_string('userdefaultvalues', 'local_ltiprovider'));

        $choices = array(0 => get_string('emaildisplayno'), 1 => get_string('emaildisplayyes'), 2 => get_string('emaildisplaycourse'));
        $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
        $mform->setDefault('maildisplay', 2);

        $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
        $mform->setType('city', PARAM_MULTILANG);
        if (empty($CFG->defaultcity)) {
            $mform->setDefault('city', $templateuser->city);
        } else {
            $mform->setDefault('city', $CFG->defaultcity);
        }
        $mform->addRule('city', get_string('required'), 'required');

        $mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
        if (empty($CFG->country)) {
            $mform->setDefault('country', $templateuser->country);
        } else {
            $mform->setDefault('country', $CFG->country);
        }
        $mform->setAdvanced('country');

        $choices = get_list_of_timezones();
        $choices['99'] = get_string('serverlocaltime');
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', $templateuser->timezone);
//.........这里部分代码省略.........
开发者ID:anilch,项目名称:Personel,代码行数:101,代码来源:edit_form.php

示例12: definition


//.........这里部分代码省略.........
        $mform->setDefault('autosubscribe', 1);

        $editors = editors_get_enabled();
        if (count($editors) > 1) {
            $choices = array();
            $choices['0'] = get_string('texteditor');
            $choices['1'] = get_string('htmleditor');
            $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
            $mform->setDefault('htmleditor', 1);
        } else {
            $mform->addElement('hidden', 'htmleditor');
            $mform->setDefault('htmleditor', 1);
            $mform->setType('htmleditor', PARAM_INT);
        }

        if (empty($CFG->enableajax)) {
            $mform->addElement('static', 'ajax', get_string('ajaxuse'), get_string('ajaxno'));
        } else {
            $choices = array( 0 => get_string('ajaxno'), 1 => get_string('ajaxyes'));
            $mform->addElement('select', 'ajax', get_string('ajaxuse'), $choices);
            $mform->setDefault('ajax', 1);
        }
        $mform->setAdvanced('ajax');

        $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
        $mform->setType('city', PARAM_MULTILANG);
        if (empty($CFG->defaultcity)) {
            $mform->setDefault('city', $templateuser->city);
        } else {
            $mform->setDefault('city', $CFG->defaultcity);
        }

        $mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
        if (empty($CFG->country)) {
            $mform->setDefault('country', $templateuser->country);
        } else {
            $mform->setDefault('country', $CFG->country);
        }
        $mform->setAdvanced('country');

        $choices = get_list_of_timezones();
        $choices['99'] = get_string('serverlocaltime');
        $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
        $mform->setDefault('timezone', $templateuser->timezone);
        $mform->setAdvanced('timezone');

        $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
        $mform->setDefault('lang', $templateuser->lang);
        $mform->setAdvanced('lang');

        $editoroptions = array('maxfiles'=>0, 'maxbytes'=>0, 'trusttext'=>false, 'forcehttps'=>false);
        $mform->addElement('editor', 'description', get_string('userdescription'), null, $editoroptions);
        $mform->setType('description', PARAM_CLEANHTML);
        $mform->addHelpButton('description', 'userdescription');
        $mform->setAdvanced('description');

        $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
        $mform->setAdvanced('url');

        $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="64" size="25"');
        $mform->setType('idnumber', PARAM_NOTAGS);

        $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
        $mform->setType('institution', PARAM_MULTILANG);
        $mform->setDefault('institution', $templateuser->institution);

        $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
        $mform->setType('department', PARAM_MULTILANG);
        $mform->setDefault('department', $templateuser->department);

        $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
        $mform->setType('phone1', PARAM_NOTAGS);
        $mform->setAdvanced('phone1');

        $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
        $mform->setType('phone2', PARAM_NOTAGS);
        $mform->setAdvanced('phone2');

        $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
        $mform->setType('address', PARAM_MULTILANG);
        $mform->setAdvanced('address');

        // Next the profile defaults
        profile_definition($mform);

        // hidden fields
        $mform->addElement('hidden', 'iid');
        $mform->setType('iid', PARAM_INT);

        $mform->addElement('hidden', 'previewrows');
        $mform->setType('previewrows', PARAM_INT);

        $mform->addElement('hidden', 'readcount');
        $mform->setType('readcount', PARAM_INT);

        $mform->addElement('hidden', 'uutype');
        $mform->setType('uutype', PARAM_INT);

        $this->add_action_buttons(true, get_string('uploadusers', 'admin'));
    }
开发者ID:nuckey,项目名称:moodle,代码行数:101,代码来源:uploaduser_form.php

示例13: definition

 function definition()
 {
     global $CFG;
     $templateuser = $this->_customdata;
     if (empty($templateuser)) {
         if (!($templateuser = get_admin())) {
             error('Could not find site admin');
         }
     }
     $mform =& $this->_form;
     $mform->addElement('file', 'userfile', get_string('file'));
     $mform->addRule('userfile', null, 'required');
     $mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
     $mform->addElement('text', 'username', get_string('username'), 'size="20"');
     $modules = get_list_of_plugins('auth');
     $auth_options = array();
     foreach ($modules as $module) {
         $auth_options[$module] = get_string("auth_{$module}" . "title", "auth");
     }
     $mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
     $mform->setDefault('auth', $templateuser->auth);
     $mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod', 'auth')));
     $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
     $choices = array(get_string('emaildisplayno'), get_string('emaildisplayyes'), get_string('emaildisplaycourse'));
     $mform->addElement('select', 'maildisplay', get_string('emaildisplay'), $choices);
     $mform->setDefault('maildisplay', 2);
     $choices = array(get_string('emailenable'), get_string('emaildisable'));
     $mform->addElement('select', 'emailstop', get_string('emailactive'), $choices);
     $choices = array(get_string('textformat'), get_string('htmlformat'));
     $mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
     $mform->setDefault('mailformat', 1);
     $choices = array(get_string('autosubscribeyes'), get_string('autosubscribeno'));
     $mform->addElement('select', 'autosubscribe', get_string('autosubscribe'), $choices);
     $mform->setDefault('autosubscribe', 1);
     if ($CFG->htmleditor) {
         $choices = array(get_string('texteditor'), get_string('htmleditor'));
         $mform->addElement('select', 'htmleditor', get_string('textediting'), $choices);
         $mform->setDefault('htmleditor', 1);
     }
     $mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
     $mform->setType('city', PARAM_MULTILANG);
     $mform->setDefault('city', $templateuser->city);
     $mform->addElement('select', 'country', get_string('selectacountry'), get_list_of_countries());
     $mform->setDefault('country', $templateuser->country);
     $choices = get_list_of_timezones();
     $choices['99'] = get_string('serverlocaltime');
     $mform->addElement('select', 'timezone', get_string('timezone'), $choices);
     $mform->setDefault('timezone', $templateuser->timezone);
     $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_list_of_languages());
     $mform->setDefault('lang', $templateuser->lang);
     $mform->addElement('htmleditor', 'description', get_string('userdescription'));
     $mform->setType('description', PARAM_CLEAN);
     $mform->setHelpButton('description', array('text', get_string('helptext')));
     $mform->addElement('text', 'url', get_string('webpage'), 'maxlength="255" size="50"');
     $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="40" size="25"');
     $mform->setType('institution', PARAM_MULTILANG);
     $mform->setDefault('institution', $templateuser->institution);
     $mform->addElement('text', 'department', get_string('department'), 'maxlength="30" size="25"');
     $mform->setType('department', PARAM_MULTILANG);
     $mform->setDefault('department', $templateuser->department);
     $mform->addElement('text', 'phone1', get_string('phone'), 'maxlength="20" size="25"');
     $mform->setType('phone1', PARAM_CLEAN);
     $mform->addElement('text', 'phone2', get_string('phone'), 'maxlength="20" size="25"');
     $mform->setType('phone2', PARAM_CLEAN);
     $mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="25"');
     $mform->setType('address', PARAM_MULTILANG);
     $mform->addElement('header', 'settingsheader', get_string('settings'));
     $choices = array(get_string('infilefield', 'auth'), get_string('createpasswordifneeded', 'auth'));
     $mform->addElement('select', 'createpassword', get_string('passwordhandling', 'auth'), $choices);
     $mform->addElement('selectyesno', 'updateaccounts', get_string('updateaccounts', 'admin'));
     $mform->addElement('selectyesno', 'allowrenames', get_string('allowrenames', 'admin'));
     $choices = array(get_string('addcounter', 'admin'), get_string('skipuser', 'admin'));
     $mform->addElement('select', 'duplicatehandling', get_string('newusernamehandling', 'admin'), $choices);
     $this->add_action_buttons(false, get_string('uploadusers'));
 }
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:75,代码来源:uploaduser_form.php

示例14: validate_core_user_data

 /**
  * Validates that core user fields are set to valid values, if they are set
  * on the import record
  *
  * @param string $action One of 'create' or 'update'
  * @param object $record The import record
  *
  * @return boolean true if the record validates correctly, otherwise false
  */
 function validate_core_user_data($action, $record, $filename)
 {
     global $CFG;
     //make sure auth plugin refers to a valid plugin
     $auths = get_plugin_list('auth');
     if (!$this->validate_fixed_list($record, 'auth', array_keys($auths))) {
         $identifier = $this->mappings['auth'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->auth}\" is not a valid auth plugin.", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     // Make sure password satisfies the site password policy (but allow "changeme" which will trigger forced password change).
     if (isset($record->password)) {
         $errmsg = '';
         if ($record->password != 'changeme' && !check_password_policy($record->password, $errmsg)) {
             $identifier = $this->mappings['password'];
             $this->fslogger->log_failure("{$identifier} value of \"{$record->password}\" does not conform to your site's password policy.", 0, $filename, $this->linenumber, $record, "user");
             return false;
         }
     }
     //make sure email is in user@domain.ext format
     if ($action == 'create') {
         if (!validate_email($record->email)) {
             $identifier = $this->mappings['email'];
             $this->fslogger->log_failure("{$identifier} value of \"{$record->email}\" is not a valid email address.", 0, $filename, $this->linenumber, $record, "user");
             return false;
         }
     }
     //make sure maildigest is one of the available values
     if (!$this->validate_fixed_list($record, 'maildigest', array(0, 1, 2))) {
         $identifier = $this->mappings['maildigest'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->maildigest}\" is not one of the available options (0, 1, 2).", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure autosubscribe is one of the available values
     if (!$this->validate_fixed_list($record, 'autosubscribe', array(0, 1), array('no' => 0, 'yes' => 1))) {
         $identifier = $this->mappings['autosubscribe'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->autosubscribe}\" is not one of the available options (0, 1).", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure trackforums can only be set if feature is enabled
     if (isset($record->trackforums)) {
         if (empty($CFG->forum_trackreadposts)) {
             $this->fslogger->log_failure("Tracking unread posts is currently disabled on this site.", 0, $filename, $this->linenumber, $record, "user");
             return false;
         }
     }
     //make sure trackforums is one of the available values
     if (!$this->validate_fixed_list($record, 'trackforums', array(0, 1), array('no' => 0, 'yes' => 1))) {
         $identifier = $this->mappings['trackforums'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->trackforums}\" is not one of the available options (0, 1).", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure screenreader is one of the available values
     if (!$this->validate_fixed_list($record, 'screenreader', array(0, 1), array('no' => 0, 'yes' => 1))) {
         $identifier = $this->mappings['screenreader'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->screenreader}\" is not one of the available options (0, 1).", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure country refers to a valid country code
     $countries = get_string_manager()->get_list_of_countries();
     if (!$this->validate_fixed_list($record, 'country', array_keys($countries), array_flip($countries))) {
         $identifier = $this->mappings['country'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->country}\" is not a valid country or country code.", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure timezone can only be set if feature is enabled
     if (isset($record->timezone)) {
         if ($CFG->forcetimezone != 99 && $record->timezone != $CFG->forcetimezone) {
             $identifier = $this->mappings['timezone'];
             $this->fslogger->log_failure("{$identifier} value of \"{$record->timezone}\" is not consistent with forced timezone value of \"{$CFG->forcetimezone}\" on your site.", 0, $filename, $this->linenumber, $record, "user");
             return false;
         }
     }
     //make sure timezone refers to a valid timezone offset
     $timezones = get_list_of_timezones();
     if (!$this->validate_fixed_list($record, 'timezone', array_keys($timezones))) {
         $identifier = $this->mappings['timezone'];
         $this->fslogger->log_failure("{$identifier} value of \"{$record->timezone}\" is not a valid timezone.", 0, $filename, $this->linenumber, $record, "user");
         return false;
     }
     //make sure theme can only be set if feature is enabled
     if (isset($record->theme)) {
         if (empty($CFG->allowuserthemes)) {
             $this->fslogger->log_failure("User themes are currently disabled on this site.", 0, $filename, $this->linenumber, $record, "user");
             return false;
         }
     }
     //make sure theme refers to a valid theme
     if ($this->themes == array()) {
         //lazy-loading of themes, store to save time
         $this->themes = get_list_of_themes();
//.........这里部分代码省略.........
开发者ID:jamesmcq,项目名称:elis,代码行数:101,代码来源:version1.class.php

示例15: array

			"default" => "0",
			"array" => array( "0" => __("Disabled"), "1" => __("Enabled"))
			),
		"i18n_timezone_support" => array(
			"friendly_name" => __("Time Zone Support"),
			"description" => __("Choose \"enabled\" to setup another time zone. If the time zone can not be modified system time zone will be used automatically."),
			"method" => "drop_array",
			"default" => "0",
			"array" => array( "0" => __("Disabled"), "1" => __("Enabled"))
			),
		"i18n_default_timezone" => array(
			"friendly_name" => __("Default Time Zone"),
			"description" => __("Default time zone for this system."),
			"method" => "drop_array",
			"default" => "0",
			"array" => get_list_of_timezones()
			),
		),
	"snmp" => array(
		"snmp_header" => array(
			"friendly_name" => __("SNMP Defaults"),
			"method" => "spacer",
			),
		"snmp_ver" => array(
			"friendly_name" => __("SNMP Version"),
			"description" => __("Default SNMP version for all new devices."),
			"method" => "drop_array",
			"default" => "1",
			"array" => $snmp_versions,
			),
		"snmp_community" => array(
开发者ID:songchin,项目名称:Cacti,代码行数:31,代码来源:global_settings.php


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