本文整理汇总了PHP中get_string_manager函数的典型用法代码示例。如果您正苦于以下问题:PHP get_string_manager函数的具体用法?PHP get_string_manager怎么用?PHP get_string_manager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_string_manager函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: definition
function definition()
{
global $USER, $CFG;
$mform = $this->_form;
$mform->addElement('header', 'createuserandpass', get_string('createuserandpass'), '');
$mform->addElement('text', 'username', get_string('username'), 'maxlength="100" size="12"');
$mform->setType('username', PARAM_NOTAGS);
$mform->addRule('username', get_string('missingusername'), 'required', null, 'server');
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
$mform->addElement('passwordunmask', 'password', get_string('password'), 'maxlength="32" size="12"');
$mform->setType('password', PARAM_RAW);
$mform->addRule('password', get_string('missingpassword'), 'required', null, 'server');
$mform->addElement('header', 'supplyinfo', get_string('supplyinfo'), '');
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"');
$mform->setType('email', PARAM_RAW_TRIMMED);
$mform->addRule('email', get_string('missingemail'), 'required', null, 'server');
$mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"');
$mform->setType('email2', PARAM_RAW_TRIMMED);
$mform->addRule('email2', get_string('missingemail'), 'required', null, 'server');
$namefields = useredit_get_required_name_fields();
foreach ($namefields as $field) {
$mform->addElement('text', $field, get_string($field), 'maxlength="100" size="30"');
$mform->setType($field, PARAM_TEXT);
$stringid = 'missing' . $field;
if (!get_string_manager()->string_exists($stringid, 'moodle')) {
$stringid = 'required';
}
$mform->addRule($field, get_string($stringid), 'required', null, 'server');
}
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="20"');
$mform->setType('city', PARAM_TEXT);
if (!empty($CFG->defaultcity)) {
$mform->setDefault('city', $CFG->defaultcity);
}
$country = get_string_manager()->get_list_of_countries();
$default_country[''] = get_string('selectacountry');
$country = array_merge($default_country, $country);
$mform->addElement('select', 'country', get_string('country'), $country);
if (!empty($CFG->country)) {
$mform->setDefault('country', $CFG->country);
} else {
$mform->setDefault('country', '');
}
if ($this->signup_captcha_enabled()) {
$mform->addElement('recaptcha', 'recaptcha_element', get_string('security_question', 'auth'), array('https' => $CFG->loginhttps));
$mform->addHelpButton('recaptcha_element', 'recaptcha', 'auth');
}
profile_signup_fields($mform);
if (!empty($CFG->sitepolicy)) {
$mform->addElement('header', 'policyagreement', get_string('policyagreement'), '');
$mform->setExpanded('policyagreement');
$mform->addElement('static', 'policylink', '', '<a href="' . $CFG->sitepolicy . '" onclick="this.target=\'_blank\'">' . get_String('policyagreementclick') . '</a>');
$mform->addElement('checkbox', 'policyagreed', get_string('policyaccept'));
$mform->addRule('policyagreed', get_string('policyagree'), 'required', null, 'server');
}
// buttons
$this->add_action_buttons(true, get_string('createaccount'));
}
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:60,代码来源:signup_form.php
示例2: get_error_message
public function get_error_message($args)
{
if (strlen($this->errorstring) && get_string_manager()->string_exists($this->errorstring, 'local_moodlecheck')) {
return get_string($this->errorstring, 'local_moodlecheck', $args);
} else {
if (get_string_manager()->string_exists('error_' . $this->code, 'local_moodlecheck')) {
return get_string('error_' . $this->code, 'local_moodlecheck', $args);
} else {
if (isset($args['line'])) {
// do not dump line number, it will be included in the final message
unset($args['line']);
}
if (is_array($args)) {
$args = ': ' . print_r($args, true);
} else {
if ($args !== true && $args !== null) {
$args = ': ' . $args;
} else {
$args = '';
}
}
return $this->get_name() . '. Error' . $args;
}
}
}
开发者ID:rtsfc,项目名称:moodle-local_moodlecheck,代码行数:25,代码来源:locallib.php
示例3: get_description
/**
* Default get description method.
*
* @return string description of the store.
*/
public function get_description()
{
if (get_string_manager()->string_exists('pluginname_desc', $this->component)) {
return get_string('pluginname_desc', $this->component);
}
return $this->store;
}
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:reader.php
示例4: definition
public function definition()
{
global $CFG, $PAGE, $DB;
$context = context_system::instance();
$mform =& $this->_form;
$strrequired = get_string('required');
$mform->addElement('hidden', 'id', $this->classroomid);
$mform->addElement('hidden', 'companyid', $this->companyid);
$mform->setType('id', PARAM_INT);
$mform->setType('companyid', PARAM_INT);
// Then show the fields about where this block appears.
$mform->addElement('header', 'header', get_string('classroom', 'block_iomad_company_admin'));
$mform->addElement('text', 'name', get_string('classroom_name', 'block_iomad_company_admin'), 'maxlength="100" size="50"');
$mform->setType('name', PARAM_NOTAGS);
$mform->addRule('name', $strrequired, 'required', null, 'client');
$mform->addElement('text', 'address', get_string('address'), 'maxlength="70" size="50"');
$mform->addRule('address', $strrequired, 'required', null, 'client');
$mform->setType('address', PARAM_NOTAGS);
$mform->addElement('text', 'city', get_string('city'), 'maxlength="120" size="50"');
$mform->addRule('city', $strrequired, 'required', null, 'client');
$mform->setType('city', PARAM_NOTAGS);
$mform->addElement('text', 'postcode', get_string('postcode', 'block_iomad_commerce'), 'maxlength="20" size="20"');
$mform->addRule('postcode', $strrequired, 'required', null, 'client');
$mform->setType('postcode', PARAM_NOTAGS);
$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');
$mform->addElement('text', 'capacity', get_string('classroom_capacity', 'block_iomad_company_admin'));
$mform->addRule('capacity', $strrequired, 'required', null, 'client');
$mform->setType('capacity', PARAM_INTEGER);
$this->add_action_buttons();
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:33,代码来源:classroom_edit_form.php
示例5: theme_archaius_process_css
/**
* Function to be called for CSS postprocess, this function replace all
* CSS tags for their values in the setting page.
* @param String $css
* @param Object $theme
* @return String $css - final CSS of the theme
*/
function theme_archaius_process_css($css, $theme)
{
$customcss = theme_archaius_check_css_setting($theme->settings->customcss);
$css = theme_archaius_replace_tag_css($css, $customcss, '[[setting:customcss]]');
$themecolor = theme_archaius_check_css_setting($theme->settings->themecolor);
$css = theme_archaius_replace_tag_css($css, $themecolor, '[[setting:themecolor]]');
$bgcolor = theme_archaius_check_css_setting($theme->settings->bgcolor);
$css = theme_archaius_replace_tag_css($css, $bgcolor, '[[setting:bgcolor]]');
$page_header_text_color = theme_archaius_check_css_setting($theme->settings->headertextcolor);
$css = theme_archaius_replace_tag_css($css, $page_header_text_color, '[[setting:headertextcolor]]');
$page_footer_text_color = theme_archaius_check_css_setting($theme->settings->footertextcolor);
$css = theme_archaius_replace_tag_css($css, $page_footer_text_color, '[[setting:footertextcolor]]');
$headercolor = theme_archaius_check_css_setting($theme->settings->headercolor);
$css = theme_archaius_replace_tag_css($css, $headercolor, '[[setting:headercolor]]');
$currentcolor = theme_archaius_check_css_setting($theme->settings->currentcolor);
$css = theme_archaius_replace_tag_css($css, $currentcolor, '[[setting:currentcolor]]');
$currentcustommenucolor = theme_archaius_check_css_setting($theme->settings->currentcustommenucolor);
$css = theme_archaius_replace_tag_css($css, $currentcustommenucolor, '[[setting:currentcustommenucolor]]');
$custommenucolor = theme_archaius_check_css_setting($theme->settings->custommenucolor);
$css = theme_archaius_replace_tag_css($css, $custommenucolor, '[[setting:custommenucolor]]');
$slideshowheight = theme_archaius_check_css_setting($theme->settings->slideshowheight);
$css = theme_archaius_set_slideshowheight($css, $slideshowheight);
$css = theme_archaius_set_css_font_replacement($css);
$css = theme_archaius_set_login_background_image($css);
$css = theme_archaius_set_login_box_width($css);
$langs = get_string_manager()->get_list_of_translations();
if (count($langs) > 1) {
$css = theme_archaius_set_custommenu_last_child($css, 'right', '6%');
} else {
$css = theme_archaius_set_custommenu_last_child($css, 'left', '0');
}
return $css;
}
开发者ID:beyondkeysystem,项目名称:moodle-theme_archaius,代码行数:40,代码来源:lib.php
示例6: render_custom_menu
protected function render_custom_menu(custom_menu $menu)
{
$langs = get_string_manager()->get_list_of_translations();
$haslangmenu = $this->lang_menu() != '';
if (!$menu->has_children() && !$haslangmenu) {
return '';
}
if ($haslangmenu) {
$strlang = get_string('language');
$currentlang = current_language();
if (isset($langs[$currentlang])) {
$currentlang = $langs[$currentlang];
} else {
$currentlang = $strlang;
}
$this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
foreach ($langs as $langtype => $langname) {
$this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
$children = $menu->get_children();
if (count($children) == 0) {
return false;
}
$content = '';
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item, 1);
}
return $content;
}
开发者ID:nzn-openapp,项目名称:moodle-theme_elegance,代码行数:30,代码来源:core_renderer.php
示例7: get_columns
/**
* Returns the all public properties from a object
* as an array to use as column names.
*
* @param array $array - an associative array with data defined
* @return array
*/
public static function get_columns($array)
{
if (!is_array($array)) {
return false;
}
$columns = array_keys($array);
$new_columns = array();
if (isset(datamap::$post_process_columns) && !empty(datamap::$post_process_columns)) {
$mapped_columns = datamap::$post_process_columns;
} else {
$mapped_columns = datamap::$columns;
}
foreach ($columns as $value) {
$newvalue = "";
if (isset($mapped_columns[$value])) {
$newvalue = $mapped_columns[$value];
} else {
$newvalue = $value;
}
if (datamap::$config['columns_get_string']) {
if (get_string_manager()->string_exists($value, 'report_cleanreport')) {
$newvalue = get_string($newvalue, 'report_cleanreport');
}
}
$new_columns[] = $newvalue;
}
return $new_columns;
}
开发者ID:rafaelpiresck,项目名称:scripts,代码行数:35,代码来源:functions.php
示例8: render_custom_menu
protected function render_custom_menu(custom_menu $menu)
{
global $CFG;
// TODO: eliminate this duplicated logic, it belongs in core, not
// here. See MDL-39565.
$addlangmenu = true;
$langs = get_string_manager()->get_list_of_translations();
if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
$addlangmenu = false;
}
if (!$menu->has_children() && $addlangmenu === false) {
return '';
}
if ($addlangmenu) {
$strlang = get_string('language');
$currentlang = current_language();
if (isset($langs[$currentlang])) {
$currentlang = $langs[$currentlang];
} else {
$currentlang = $strlang;
}
$this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
foreach ($langs as $langtype => $langname) {
$this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
}
}
$content = '<ul class="nav">';
foreach ($menu->get_children() as $item) {
$content .= $this->render_custom_menu_item($item, 1);
}
return $content . '</ul>';
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:32,代码来源:renderers.php
示例9: definition
/**
* Define this form - called by the parent constructor
*/
public function definition()
{
global $COURSE, $USER;
$mform = $this->_form;
$params = $this->_customdata;
$choices = get_string_manager()->get_list_of_countries();
$choices = array('' => get_string('selectacountry') . '...') + $choices;
$mform->addElement('select', 'country', 'Country for E-signature', $choices);
$mform->setDefault('country', 'SE');
if (isset($_SESSION['assign' . $params['cm']]['signedtoken']) && $_SESSION['assign' . $params['cm']]['signedtoken']) {
$mform->addElement('static', 'description', '', get_string('esignalreadyadded', 'assignfeedback_esign'));
} else {
$mform->addElement('static', 'description', '', get_string('addesignforall', 'assignfeedback_esign'));
}
$mform->addRule('country', get_string('selectacountry'), 'required', '', 'client', false, false);
$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', 'addesign');
$mform->setType('pluginaction', PARAM_ALPHA);
$mform->addElement('hidden', 'plugin', 'esign');
$mform->setType('plugin', PARAM_PLUGIN);
$mform->addElement('hidden', 'pluginsubtype', 'assignfeedback');
$mform->setType('pluginsubtype', PARAM_PLUGIN);
if (isset($_SESSION['assign' . $params['cm']]['signedtoken']) && $_SESSION['assign' . $params['cm']]['signedtoken']) {
$this->add_action_buttons(true, get_string('updateesign', 'assignfeedback_esign'));
} else {
$this->add_action_buttons(true, get_string('addesign', 'assignfeedback_esign'));
}
}
开发者ID:dsv-su,项目名称:moodle-assignfeedback_esign,代码行数:34,代码来源:esignform.php
示例10: definition_after_data
function definition_after_data()
{
global $CFG, $DB, $OUTPUT;
$mform =& $this->_form;
$userid = $mform->getElementValue('id');
// if language does not exist, use site default lang
if ($langsel = $mform->getElementValue('lang')) {
$lang = reset($langsel);
// check lang exists
if (!get_string_manager()->translation_exists($lang, false)) {
$lang_el =& $mform->getElement('lang');
$lang_el->setValue($CFG->lang);
}
}
if ($user = $DB->get_record('user', array('id' => $userid))) {
// remove description
if (empty($user->description) && !empty($CFG->profilesforenrolledusersonly) && !$DB->record_exists('role_assignments', array('userid' => $userid))) {
$mform->removeElement('description_editor');
}
// print picture
$context = context_user::instance($user->id, MUST_EXIST);
$fs = get_file_storage();
$hasuploadedpicture = $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.png') || $fs->file_exists($context->id, 'user', 'icon', 0, '/', 'f2.jpg');
if (!empty($user->picture) && $hasuploadedpicture) {
$imagevalue = $OUTPUT->user_picture($user, array('courseid' => SITEID, 'size' => 64));
} else {
$imagevalue = get_string('none');
}
$imageelement = $mform->getElement('currentpicture');
$imageelement->setValue($imagevalue);
if ($mform->elementExists('deletepicture') && !$hasuploadedpicture) {
$mform->removeElement('deletepicture');
}
/// disable fields that are locked by auth plugins
$fields = get_user_fieldnames();
$authplugin = get_auth_plugin($user->auth);
foreach ($fields as $field) {
if (!$mform->elementExists($field)) {
continue;
}
$configvariable = 'field_lock_' . $field;
if (isset($authplugin->config->{$configvariable})) {
if ($authplugin->config->{$configvariable} === 'locked') {
$mform->hardFreeze($field);
$mform->setConstant($field, $user->{$field});
} else {
if ($authplugin->config->{$configvariable} === 'unlockedifempty' and $user->{$field} != '') {
$mform->hardFreeze($field);
$mform->setConstant($field, $user->{$field});
}
}
}
}
/// Next the customisable profile fields
profile_definition_after_data($mform, $user->id);
} else {
profile_definition_after_data($mform, 0);
}
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:59,代码来源:edit_form.php
示例11: iplookup_find_location
/**
* Returns location information
* @param string $ip
* @return array
*/
function iplookup_find_location($ip)
{
global $CFG;
$info = array('city' => null, 'country' => null, 'longitude' => null, 'latitude' => null, 'error' => null, 'note' => '', 'title' => array());
if (!empty($CFG->geoip2file) and file_exists($CFG->geoip2file)) {
$reader = new GeoIp2\Database\Reader($CFG->geoip2file);
$record = $reader->city($ip);
if (empty($record)) {
$info['error'] = get_string('iplookupfailed', 'error', $ip);
return $info;
}
$info['city'] = core_text::convert($record->city->name, 'iso-8859-1', 'utf-8');
$info['title'][] = $info['city'];
$countrycode = $record->country->isoCode;
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// Prefer our localized country names.
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = $record->country->names['en'];
}
$info['title'][] = $info['country'];
$info['longitude'] = $record->location->longitude;
$info['latitude'] = $record->location->latitude;
$info['note'] = get_string('iplookupmaxmindnote', 'admin');
return $info;
} else {
require_once $CFG->libdir . '/filelib.php';
if (strpos($ip, ':') !== false) {
// IPv6 is not supported by geoplugin.net.
$info['error'] = get_string('invalidipformat', 'error');
return $info;
}
$ipdata = download_file_content('http://www.geoplugin.net/json.gp?ip=' . $ip);
if ($ipdata) {
$ipdata = preg_replace('/^geoPlugin\\((.*)\\)\\s*$/s', '$1', $ipdata);
$ipdata = json_decode($ipdata, true);
}
if (!is_array($ipdata)) {
$info['error'] = get_string('cannotgeoplugin', 'error');
return $info;
}
$info['latitude'] = (double) $ipdata['geoplugin_latitude'];
$info['longitude'] = (double) $ipdata['geoplugin_longitude'];
$info['city'] = s($ipdata['geoplugin_city']);
$countrycode = $ipdata['geoplugin_countryCode'];
$countries = get_string_manager()->get_list_of_countries(true);
if (isset($countries[$countrycode])) {
// prefer our localized country names
$info['country'] = $countries[$countrycode];
} else {
$info['country'] = s($ipdata['geoplugin_countryName']);
}
$info['note'] = get_string('iplookupgeoplugin', 'admin');
$info['title'][] = $info['city'];
$info['title'][] = $info['country'];
return $info;
}
}
开发者ID:gabrielrosset,项目名称:moodle,代码行数:64,代码来源:lib.php
示例12: local_name
/**
* @return string the name of this question type in the user's language.
* You should not need to override this method, the default behaviour should be fine.
*/
public function local_name()
{
if (get_string_manager()->string_exists('pluginname', $this->plugin_name())) {
return get_string('pluginname', $this->plugin_name());
} else {
return get_string($this->name(), $this->plugin_name());
}
}
开发者ID:rosenclever,项目名称:moodle,代码行数:12,代码来源:questiontypebase.php
示例13: init_display_name
public function init_display_name()
{
if (get_string_manager()->string_exists('pluginname', $this->component)) {
$this->displayname = get_string('pluginname', $this->component);
} else {
$this->displayname = get_string('modulename', $this->component);
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:8,代码来源:mod.php
示例14: atto_multilang2_params_for_js
/**
* Set parameters for this plugin.
*
* @return array The JSON encoding of the installed languages.
*/
function atto_multilang2_params_for_js()
{
$languages = json_encode(get_string_manager()->get_list_of_translations());
$capability = get_capability();
$highlight = get_config('atto_multilang2', 'highlight') === '1' ? true : false;
$css = get_config('atto_multilang2', 'customcss');
return array('languages' => $languages, 'capability' => $capability, 'highlight' => $highlight, 'css' => $css);
}
开发者ID:julenpardo,项目名称:moodle-atto_multilang2,代码行数:13,代码来源:lib.php
示例15: init_display_name
public function init_display_name()
{
if (!get_string_manager()->string_exists('filtername', $this->component)) {
$this->displayname = '[filtername,' . $this->component . ']';
} else {
$this->displayname = get_string('filtername', $this->component);
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:8,代码来源:filter.php
示例16: init_display_name
/**
* Display name
*/
public function init_display_name()
{
if (!get_string_manager()->string_exists('dataformat', $this->component)) {
$this->displayname = '[dataformat,' . $this->component . ']';
} else {
$this->displayname = get_string('dataformat', $this->component);
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:11,代码来源:dataformat.php
示例17: scheduler_compile_mail_template
/**
* Gets the content of an e-mail from language strings
*
* Looks for the language string email_$template_$format and replaces the parameter values.
*
* @param template the template's identified
* @param string $format tthe mail format ('subject', 'html' or 'plain')
* @param infomap a hash containing pairs of parm => data to replace in template
* @return a fully resolved template where all data has been injected
*/
function scheduler_compile_mail_template($template, $format, $infomap, $module = 'scheduler', $lang = null)
{
$params = array();
foreach ($infomap as $key => $value) {
$params[strtolower($key)] = $value;
}
$mailstr = get_string_manager()->get_string("email_{$template}_{$format}", $module, $params, $lang);
return $mailstr;
}
开发者ID:ninelanterns,项目名称:moodle-mod_scheduler,代码行数:19,代码来源:mailtemplatelib.php
示例18: specific_definition
protected function specific_definition($mform)
{
$mform->addElement('header', 'configheader', get_string('messagesettings', 'block_cancelcourse'));
$lang = array_merge(array('' => get_string('none', 'block_cancelcourse')), get_string_manager()->get_list_of_translations());
//var_dump($lang);
$mform->addElement('select', 'config_language', get_string('config_language', 'block_cancelcourse'), $lang);
$mform->addElement('text', 'config_profname', get_string('config_profname', 'block_cancelcourse'));
$mform->setType('config_profname', PARAM_NOTAGS);
}
开发者ID:liamhanks,项目名称:Cancel-Course,代码行数:9,代码来源:edit_form.php
示例19: get_form_elements
/**
* Get form elements for the grading page
*
* @param stdClass|null $grade
* @param MoodleQuickForm $mform
* @param stdClass $data
* @return bool true if elements were added to the form
*/
public function get_form_elements($grade, MoodleQuickForm $mform, stdClass $data)
{
$choices = get_string_manager()->get_list_of_countries();
$choices = array('' => get_string('selectacountry') . '...') + $choices;
$mform->addElement('select', 'country', 'Country for E-signature', $choices);
$mform->addElement('static', 'description', '', get_string('savechanges', 'assignfeedback_esign'));
$mform->setDefault('country', 'SE');
$mform->addRule('country', get_string('selectacountry'), 'required', '', 'client', false, false);
return true;
}
开发者ID:dsv-su,项目名称:moodle-assignfeedback_esign,代码行数:18,代码来源:locallib.php
示例20: definition
protected function definition()
{
global $OUTPUT;
$mform = $this->_form;
$defaultcategory = $this->_customdata['defaultcategory'];
$contexts = $this->_customdata['contexts'];
// Choice of import format, with help icons.
$mform->addElement('header', 'fileformat', get_string('fileformat', 'question'));
$fileformatnames = get_import_export_formats('import');
$radioarray = array();
$separators = array();
foreach ($fileformatnames as $shortname => $fileformatname) {
$radioarray[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname);
$separator = '';
if (get_string_manager()->string_exists('pluginname_help', 'qformat_' . $shortname)) {
$separator .= $OUTPUT->help_icon('pluginname', 'qformat_' . $shortname);
}
$separator .= '<br>';
$separators[] = $separator;
}
$radioarray[] = $mform->createElement('static', 'makelasthelpiconshowup', '');
$mform->addGroup($radioarray, "formatchoices", '', $separators, false);
$mform->addRule("formatchoices", null, 'required', null, 'client');
// Import options.
$mform->addElement('header', 'general', get_string('general', 'form'));
$mform->addElement('questioncategory', 'category', get_string('importcategory', 'question'), compact('contexts'));
$mform->setDefault('category', $defaultcategory);
$mform->addHelpButton('category', 'importcategory', 'question');
$categorygroup = array();
$categorygroup[] = $mform->createElement('checkbox', 'catfromfile', '', get_string('getcategoryfromfile', 'question'));
$categorygroup[] = $mform->createElement('checkbox', 'contextfromfile', '', get_string('getcontextfromfile', 'question'));
$mform->addGroup($categorygroup, 'categorygroup', '', '', false);
$mform->disabledIf('categorygroup', 'catfromfile', 'notchecked');
$mform->setDefault('catfromfile', 1);
$mform->setDefault('contextfromfile', 1);
$matchgrades = array();
$matchgrades['error'] = get_string('matchgradeserror', 'question');
$matchgrades['nearest'] = get_string('matchgradesnearest', 'question');
$mform->addElement('select', 'matchgrades', get_string('matchgrades', 'question'), $matchgrades);
$mform->addHelpButton('matchgrades', 'matchgrades', 'question');
$mform->setDefault('matchgrades', 'error');
$mform->addElement('selectyesno', 'stoponerror', get_string('stoponerror', 'question'));
$mform->setDefault('stoponerror', 1);
$mform->addHelpButton('stoponerror', 'stoponerror', 'question');
// The file to import
$mform->addElement('header', 'importfileupload', get_string('importquestions', 'question'));
$mform->addElement('filepicker', 'newfile', get_string('import'));
$mform->addRule('newfile', null, 'required', null, 'client');
// Submit button.
$mform->addElement('submit', 'submitbutton', get_string('import'));
// Set a template for the format select elements
$renderer = $mform->defaultRenderer();
$template = "{help} {element}\n";
$renderer->setGroupElementTemplate($template, 'format');
}
开发者ID:evltuma,项目名称:moodle,代码行数:55,代码来源:import_form.php
注:本文中的get_string_manager函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论