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


PHP core_text::get_encodings方法代码示例

本文整理汇总了PHP中core_text::get_encodings方法的典型用法代码示例。如果您正苦于以下问题:PHP core_text::get_encodings方法的具体用法?PHP core_text::get_encodings怎么用?PHP core_text::get_encodings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_text的用法示例。


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

示例1: definition

 /**
  * Definition method.
  */
 public function definition()
 {
     global $COURSE;
     $mform = $this->_form;
     if (isset($this->_customdata)) {
         // Hardcoding plugin names here is hacky.
         $features = $this->_customdata;
     } else {
         $features = array();
     }
     // Course id needs to be passed for auth purposes.
     $mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
     $mform->setType('id', PARAM_INT);
     $mform->addElement('header', 'general', get_string('pluginname', 'gradeimport_direct'));
     // Data upload from copy/paste.
     $mform->addElement('textarea', 'userdata', 'Data', array('rows' => 10, 'class' => 'gradeimport_data_area'));
     $mform->addRule('userdata', null, 'required');
     $mform->setType('userdata', PARAM_RAW);
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     if (!empty($features['verbosescales'])) {
         $options = array(1 => get_string('yes'), 0 => get_string('no'));
         $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
     }
     $options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
     $mform->setType('previewrows', PARAM_INT);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:jtibbetts,项目名称:moodle,代码行数:34,代码来源:import_form.php

示例2: definition

 /**
  * The form's definition.
  */
 public function definition()
 {
     $mform =& $this->_form;
     $data = $this->_customdata;
     $mform->addElement('hidden', 'action', 'upload_group_data');
     $mform->setType('action', PARAM_ALPHA);
     $mform->addElement('hidden', 'id', $data['id']);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('html', get_string('upload_help', 'block_upload_group'));
     $mform->addElement('header', 'upload_group_data', get_string('upload_group_data', 'block_upload_group'));
     // Add a file manager.
     $mform->addElement('filepicker', 'group_data', '');
     // Add the encoding option.
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'block_upload_group'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     // Add the delimiter option.
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter', get_string('delimiter', 'block_upload_group'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'preview_num', get_string('row_preview_num', 'block_upload_group'), $choices);
     $mform->setType('preview_num', PARAM_INT);
     $this->add_action_buttons(true, get_string('submit_group_data', 'block_upload_group'));
 }
开发者ID:at-tools,项目名称:moodle-block_uploadgroups,代码行数:36,代码来源:forms.php

示例3: definition

 /**
  * Defines the form, which will have:
  *  - Input for courses csv.
  *  - Input for users csv.
  *  - Input for logs csv.
  *  - Select for csv delimiter.
  *  - Select for files encoding.
  */
 public function definition()
 {
     $mform = $this->_form;
     $mform->addElement('header', 'settingsheader', get_string('upload', 'block_mycourse_recommendations'));
     $mform->addElement('static', 'description', '', get_string('upload_desc', 'block_mycourse_recommendations'));
     $mform->addElement('static', 'description', get_string('coursefile', 'block_mycourse_recommendations'), get_string('coursefile_desc', 'block_mycourse_recommendations'));
     $mform->addElement('filepicker', 'courses', '');
     $mform->addRule('courses', null, 'required');
     $mform->addElement('static', 'description', get_string('usersfile', 'block_mycourse_recommendations'), get_string('usersfile_desc', 'block_mycourse_recommendations'));
     $mform->addElement('filepicker', 'users', '');
     $mform->addRule('users', null, 'required');
     $mform->addElement('static', 'description', get_string('logsfile', 'block_mycourse_recommendations'), get_string('logsfile_desc', 'block_mycourse_recommendations'));
     $mform->addElement('filepicker', 'logs', '');
     $mform->addRule('logs', null, 'required');
     $choices = \csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = \core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $this->add_action_buttons(false, get_string('uploaddata', 'block_mycourse_recommendations'));
 }
开发者ID:julenpardo,项目名称:moodle-block_mycourse_recommendations,代码行数:38,代码来源:import_form.php

示例4: definition

 function definition()
 {
     $mform = $this->_form;
     $mform->addElement('header', 'settingsheader', get_string('upload'));
     $mform->addElement('filepicker', 'userfile', get_string('file'));
     $mform->addRule('userfile', null, 'required');
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $choices = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'tool_uploaduser'), $choices);
     $mform->setType('previewrows', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadusers', 'tool_uploaduser'));
 }
开发者ID:janeklb,项目名称:moodle,代码行数:25,代码来源:user_form.php

示例5: definition

 /**
  * Form definition
  */
 public function definition()
 {
     $mform = $this->_form;
     $data = (object) $this->_customdata;
     $mform->addElement('hidden', 'returnurl');
     $mform->setType('returnurl', PARAM_URL);
     $mform->addElement('header', 'cohortfileuploadform', get_string('uploadafile'));
     $filepickeroptions = array();
     $filepickeroptions['filetypes'] = '*';
     $filepickeroptions['maxbytes'] = get_max_upload_file_size();
     $mform->addElement('filepicker', 'cohortfile', get_string('file'), null, $filepickeroptions);
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter', get_string('csvdelimiter', 'tool_uploadcourse'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter', 'semicolon');
         } else {
             $mform->setDefault('delimiter', 'comma');
         }
     }
     $mform->addHelpButton('delimiter', 'csvdelimiter', 'tool_uploadcourse');
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploadcourse'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $mform->addHelpButton('encoding', 'encoding', 'tool_uploadcourse');
     $options = $this->get_context_options();
     $mform->addElement('select', 'contextid', get_string('defaultcontext', 'cohort'), $options);
     $this->add_cohort_upload_buttons(true);
     $this->set_data($data);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:35,代码来源:upload_form.php

示例6: definition_expimp_settings

 /**
  *
  */
 protected function definition_expimp_settings()
 {
     $mform =& $this->_form;
     $mform->addElement('header', 'expimpsettingshdr', get_string('expimpsettings', 'dataformview_csv'));
     // Enable import  (param4).
     $mform->addElement('advcheckbox', 'param4', get_string('export', 'grades'), get_string('enable'), null, array(0, 1));
     $mform->setDefault('param4', 1);
     // Enable import  (param4).
     $mform->addElement('advcheckbox', 'param5', get_string('import'), get_string('enable'), null, array(0, 1));
     $mform->setDefault('param5', 1);
     // Allow update existing entries  (param4)
     // $mform->addElement('advcheckbox', 'updateexisting',  null, get_string('allowupdateexisting', 'dataformview_csv'), null, array(0, 1));
     // $mform->disabledIf('updateexisting', 'importenable', 'eq', 0);.
     // Delimiter.
     $delimiters = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter', get_string('csvdelimiter', 'dataform'), $delimiters);
     $mform->setDefault('delimiter', 'comma');
     // Enclosure.
     $mform->addElement('text', 'enclosure', get_string('csvenclosure', 'dataform'), array('size' => '10'));
     $mform->setType('enclosure', PARAM_NOTAGS);
     $mform->setDefault('enclosure', '');
     // Encoding.
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:29,代码来源:form.php

示例7: definition

 /**
  * The standard form definiton.
  */
 public function definition()
 {
     $mform = $this->_form;
     $selectedfields = $this->_customdata['selectedfields'];
     $overrides = $this->_customdata['overrides'];
     $fields = tool_downloaddata_processor::get_valid_course_fields();
     if (empty($selectedfields)) {
         $selectedfields = array(get_string('noselectedfields', 'tool_downloaddata'));
     }
     $mform->addElement('header', 'generalhdr', get_string('downloadcourses', 'tool_downloaddata'));
     $formatchoices = array(tool_downloaddata_processor::FORMAT_CSV => get_string('formatcsv', 'tool_downloaddata'), tool_downloaddata_processor::FORMAT_XLS => get_string('formatxls', 'tool_downloaddata'));
     $mform->addElement('select', 'format', get_string('format', 'tool_downloaddata'), $formatchoices);
     $mform->setDefault('format', $this->_customdata['format']);
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_downloaddata'), $encodings);
     $mform->setDefault('encoding', $this->_customdata['encoding']);
     $mform->disabledIf('encoding', 'format', 'noteq', tool_downloaddata_processor::FORMAT_CSV);
     $delimiters = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_downloaddata'), $delimiters);
     $mform->setDefault('delimiter_name', $this->_customdata['delimiter_name']);
     $mform->disabledIf('delimiter_name', 'format', 'noteq', tool_downloaddata_processor::FORMAT_CSV);
     $useoverrides = array('true' => 'Yes', 'false' => 'No');
     $mform->addElement('select', 'useoverrides', get_string('useoverrides', 'tool_downloaddata'), $useoverrides);
     $mform->setDefault('useoverrides', $this->_customdata['useoverrides']);
     $mform->addHelpButton('useoverrides', 'useoverrides', 'tool_downloaddata');
     $sortbycategorypath = array('true' => 'Yes', 'false' => 'No');
     $mform->addElement('select', 'sortbycategorypath', get_string('sortbycategorypath', 'tool_downloaddata'), $sortbycategorypath);
     $mform->setDefault('sortbycategorypath', $this->_customdata['sortbycategorypath']);
     $mform->addHelpButton('sortbycategorypath', 'sortbycategorypath', 'tool_downloaddata');
     $mform->addElement('header', 'fieldshdr', get_string('fields', 'tool_downloaddata'));
     $mform->setExpanded('fieldshdr', true);
     // Creating the field selection elements.
     $objs = array();
     $objs[0] = $mform->createElement('select', 'availablefields', get_string('available', 'tool_downloaddata'), $fields, 'size="10"');
     $objs[0]->setMultiple(true);
     $objs[1] = $mform->createElement('select', 'selectedfields', get_string('selected', 'tool_downloaddata'), $selectedfields, 'size="10"');
     $objs[1]->setMultiple(true);
     $group = $mform->addElement('group', 'fieldsgroup', get_string('fields', 'tool_downloaddata'), $objs, '  ', false);
     $mform->addHelpButton('fieldsgroup', 'fields', 'tool_downloaddata');
     // Creating the buttons for the field selection elements.
     $objs = array();
     $objs[] = $mform->createElement('submit', 'addfieldselection', get_string('addfieldselection', 'tool_downloaddata'));
     $objs[] = $mform->createElement('submit', 'removefieldselection', get_string('removefieldselection', 'tool_downloaddata'));
     $objs[] = $mform->createElement('submit', 'addallfields', get_string('addallfields', 'tool_downloaddata'));
     $objs[] = $mform->createElement('submit', 'removeallfields', get_string('removeallfields', 'tool_downloaddata'));
     $group = $mform->addElement('group', 'buttonsgroup', '', $objs, array(' ', '<br/>'), false);
     $mform->addElement('header', 'overrideshdr', get_string('overrides', 'tool_downloaddata'));
     $mform->addElement('textarea', 'overrides', get_string('overrides', 'tool_downloaddata'), 'wrap="virtual" rows="3" cols="45"');
     $mform->setType('overrides', PARAM_RAW);
     $mform->setDefault('overrides', $overrides);
     $mform->addHelpButton('overrides', 'overrides', 'tool_downloaddata');
     if (empty($overrides)) {
         $mform->setExpanded('overrideshdr', false);
     } else {
         $mform->setExpanded('overrideshdr', true);
     }
     $this->add_action_buttons(false, get_string('download', 'tool_downloaddata'));
     $template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
     $mform->defaultRenderer()->setGroupElementTemplate($template, 'fieldsgroup');
 }
开发者ID:alexandru-elisei,项目名称:moodle-tool_downloaddata,代码行数:63,代码来源:courses_form.php

示例8: definition

 /**
  * Define this form - called by the parent constructor
  */
 public function definition()
 {
     global $COURSE, $USER;
     $mform = $this->_form;
     $params = $this->_customdata;
     $mform->addElement('header', 'uploadgrades', get_string('uploadgrades', 'assignfeedback_offline'));
     $fileoptions = array('subdirs' => 0, 'maxbytes' => $COURSE->maxbytes, 'accepted_types' => 'csv', 'maxfiles' => 1, 'return_types' => FILE_INTERNAL);
     $mform->addElement('filepicker', 'gradesfile', get_string('uploadafile'), null, $fileoptions);
     $mform->addRule('gradesfile', get_string('uploadnofilefound'), 'required', null, 'client');
     $mform->addHelpButton('gradesfile', 'gradesfile', 'assignfeedback_offline');
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     $mform->addHelpButton('encoding', 'encoding', 'grades');
     $radio = array();
     $radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
     $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
     $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcolon', 'grades'), 'colon');
     $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepsemicolon', 'grades'), 'semicolon');
     $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
     $mform->addHelpButton('separator', 'separator', 'grades');
     $mform->setDefault('separator', 'comma');
     $mform->addElement('checkbox', 'ignoremodified', '', get_string('ignoremodified', 'assignfeedback_offline'));
     $mform->addHelpButton('ignoremodified', 'ignoremodified', 'assignfeedback_offline');
     $mform->addElement('hidden', 'id', $params['cm']);
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'action', 'viewpluginpage');
     $mform->setType('action', PARAM_ALPHA);
     $mform->addElement('hidden', 'pluginaction', 'uploadgrades');
     $mform->setType('pluginaction', PARAM_ALPHA);
     $mform->addElement('hidden', 'plugin', 'offline');
     $mform->setType('plugin', PARAM_PLUGIN);
     $mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
     $mform->setType('pluginsubtype', PARAM_PLUGIN);
     $this->add_action_buttons(true, get_string('uploadgrades', 'assignfeedback_offline'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:38,代码来源:uploadgradesform.php

示例9: definition

 /**
  * Form definition
  */
 public function definition()
 {
     $mform =& $this->_form;
     $course = $this->_customdata['course'];
     $config = get_config('local_mass_enroll');
     $mform->addElement('header', 'general', '');
     // Fill in the data depending on page params.
     // Later using set_data.
     $mform->addElement('filepicker', 'attachment', get_string('location', 'enrol_flatfile'));
     $mform->addRule('attachment', null, 'required');
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = \core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $ids = array('idnumber' => get_string('idnumber', 'local_mass_enroll'), 'username' => get_string('username', 'local_mass_enroll'), 'email' => get_string('email'));
     $mform->addElement('select', 'firstcolumn', get_string('firstcolumn', 'local_mass_enroll'), $ids);
     $mform->setDefault('firstcolumn', 'idnumber');
     $mform->addElement('selectyesno', 'mailreport', get_string('mailreport', 'local_mass_enroll'));
     $mform->setDefault('mailreport', (int) $config->mailreportdefault);
     // Buttons.
     $this->add_action_buttons(true, get_string('unenroll', 'local_mass_enroll'));
     $mform->addElement('hidden', 'id', $course->id);
     $mform->setType('id', PARAM_INT);
 }
开发者ID:rogiervandongen,项目名称:moodle-local_mass_enroll,代码行数:37,代码来源:mass_unenroll_form.php

示例10: definition

 function definition()
 {
     global $COURSE;
     $mform =& $this->_form;
     if (isset($this->_customdata)) {
         // hardcoding plugin names here is hacky
         $features = $this->_customdata;
     } else {
         $features = array();
     }
     // course id needs to be passed for auth purposes
     $mform->addElement('hidden', 'id', optional_param('id', 0, PARAM_INT));
     $mform->setType('id', PARAM_INT);
     $mform->addElement('header', 'general', get_string('importfile', 'grades'));
     // Restrict the possible upload file types.
     if (!empty($features['acceptedtypes'])) {
         $acceptedtypes = $features['acceptedtypes'];
     } else {
         $acceptedtypes = '*';
     }
     // File upload.
     $mform->addElement('filepicker', 'userfile', get_string('file'), null, array('accepted_types' => $acceptedtypes));
     $mform->addRule('userfile', null, 'required');
     $encodings = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'grades'), $encodings);
     $mform->addHelpButton('encoding', 'encoding', 'grades');
     if (!empty($features['includeseparator'])) {
         $radio = array();
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('septab', 'grades'), 'tab');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcomma', 'grades'), 'comma');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepcolon', 'grades'), 'colon');
         $radio[] = $mform->createElement('radio', 'separator', null, get_string('sepsemicolon', 'grades'), 'semicolon');
         $mform->addGroup($radio, 'separator', get_string('separator', 'grades'), ' ', false);
         $mform->addHelpButton('separator', 'separator', 'grades');
         $mform->setDefault('separator', 'comma');
     }
     if (!empty($features['verbosescales'])) {
         $options = array(1 => get_string('yes'), 0 => get_string('no'));
         $mform->addElement('select', 'verbosescales', get_string('verbosescales', 'grades'), $options);
         $mform->addHelpButton('verbosescales', 'verbosescales', 'grades');
     }
     $options = array('10' => 10, '20' => 20, '100' => 100, '1000' => 1000, '100000' => 100000);
     $mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'grades'), $options);
     // TODO: localize
     $mform->addHelpButton('previewrows', 'rowpreviewnum', 'grades');
     $mform->setType('previewrows', PARAM_INT);
     $mform->addElement('checkbox', 'forceimport', get_string('forceimport', 'grades'));
     $mform->addHelpButton('forceimport', 'forceimport', 'grades');
     $mform->setDefault('forceimport', false);
     $mform->setType('forceimport', PARAM_BOOL);
     $mform->addElement('hidden', 'groupid', groups_get_course_group($COURSE));
     $mform->setType('groupid', PARAM_INT);
     $this->add_action_buttons(false, get_string('uploadgrades', 'grades'));
 }
开发者ID:evltuma,项目名称:moodle,代码行数:54,代码来源:grade_import_form.php

示例11: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $cmid = $this->_customdata['id'];
     $mform->addElement('filepicker', 'recordsfile', get_string('csvfile', 'data'));
     $delimiters = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'fielddelimiter', get_string('fielddelimiter', 'data'), $delimiters);
     $mform->setDefault('fielddelimiter', 'comma');
     $mform->addElement('text', 'fieldenclosure', get_string('fieldenclosure', 'data'));
     $mform->setType('fieldenclosure', PARAM_CLEANHTML);
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('fileencoding', 'mod_data'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     $submit_string = get_string('submit');
     // data id
     $mform->addElement('hidden', 'd');
     $mform->setType('d', PARAM_INT);
     $this->add_action_buttons(false, $submit_string);
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:20,代码来源:import_form.php

示例12: 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

示例13: test_get_encodings

 /**
  * Tests the static get_encodings method.
  */
 public function test_get_encodings()
 {
     $encodings = core_text::get_encodings();
     $this->assertTrue(is_array($encodings));
     $this->assertTrue(count($encodings) > 1);
     $this->assertTrue(isset($encodings['UTF-8']));
 }
开发者ID:rushi963,项目名称:moodle,代码行数:10,代码来源:text_test.php

示例14: defined

// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * Flatfile enrolments plugin settings and presets.
 *
 * @package    enrol_flatfile
 * @copyright  2010 Eugene Venter
 * @author     Eugene Venter - based on code by Petr Skoda and others
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
defined('MOODLE_INTERNAL') || die;
require_once __DIR__ . '/adminlib.php';
if ($ADMIN->fulltree) {
    //--- general settings -----------------------------------------------------------------------------------
    $settings->add(new admin_setting_heading('enrol_flatfile_settings', '', get_string('pluginname_desc', 'enrol_flatfile')));
    $settings->add(new admin_setting_configfile('enrol_flatfile/location', get_string('location', 'enrol_flatfile'), get_string('location_desc', 'enrol_flatfile'), ''));
    $options = core_text::get_encodings();
    $settings->add(new admin_setting_configselect('enrol_flatfile/encoding', get_string('encoding', 'enrol_flatfile'), '', 'UTF-8', $options));
    $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailstudents', get_string('notifyenrolled', 'enrol_flatfile'), '', 0));
    $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailteachers', get_string('notifyenroller', 'enrol_flatfile'), '', 0));
    $settings->add(new admin_setting_configcheckbox('enrol_flatfile/mailadmins', get_string('notifyadmin', 'enrol_flatfile'), '', 0));
    $options = array(ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'), ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'));
    $settings->add(new admin_setting_configselect('enrol_flatfile/unenrolaction', get_string('extremovedaction', 'enrol'), get_string('extremovedaction_help', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
    // Note: let's reuse the ext sync constants and strings here, internally it is very similar,
    //       it describes what should happen when users are not supposed to be enrolled any more.
    $options = array(ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'), ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'), ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'));
    $settings->add(new admin_setting_configselect('enrol_flatfile/expiredaction', get_string('expiredaction', 'enrol_flatfile'), get_string('expiredaction_help', 'enrol_flatfile'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
    //--- mapping -------------------------------------------------------------------------------------------
    if (!during_initial_install()) {
        $settings->add(new admin_setting_heading('enrol_flatfile_mapping', get_string('mapping', 'enrol_flatfile'), ''));
        $roles = role_fix_names(get_all_roles());
        foreach ($roles as $role) {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:settings.php

示例15: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $post_max_size = ini_get('post_max_size');
     $post_max_size_bytes = core_text::substr($post_max_size, 0, core_text::strlen($post_max_size) - 1) * (1024 * 1024);
     $post_max_size_bytes = $CFG->maxbytes != 0 && $CFG->maxbytes < $post_max_size_bytes ? $CFG->maxbytes : $post_max_size_bytes;
     $post_max_size = $post_max_size_bytes / (1024 * 1024);
     $mform->addElement('filepicker', 'import_marsupial', get_string('keymanager_import_explanation', 'local_rcommon', $post_max_size), null, array('accepted_types' => 'text/csv', 'maxbytes' => $post_max_size_bytes));
     $mform->addRule('import_marsupial', null, 'required');
     $choices = csv_import_reader::get_delimiter_list();
     $mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
     if (array_key_exists('cfg', $choices)) {
         $mform->setDefault('delimiter_name', 'cfg');
     } else {
         if (get_string('listsep', 'langconfig') == ';') {
             $mform->setDefault('delimiter_name', 'semicolon');
         } else {
             $mform->setDefault('delimiter_name', 'comma');
         }
     }
     $choices = core_text::get_encodings();
     $mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
     $mform->setDefault('encoding', 'UTF-8');
     // hidden fields
     $mform->addElement('hidden', 'iid');
     $mform->setType('iid', PARAM_INT);
     //buttons
     $this->add_action_buttons(true, get_string('keymanager_import_button', 'local_rcommon'));
 }
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:30,代码来源:forms.php


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