本文整理汇总了PHP中editors_get_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP editors_get_enabled函数的具体用法?PHP editors_get_enabled怎么用?PHP editors_get_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了editors_get_enabled函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editors_get_preferred_editor
/**
* Returns users preferred editor for given format
*
* @param int $format text format or null of none
* @return texteditor object
*/
function editors_get_preferred_editor($format = NULL)
{
global $USER;
$enabled = editors_get_enabled();
$preference = get_user_preferences('htmleditor', '', $USER);
if (isset($enabled[$preference])) {
// Edit the list of editors so the users preferred editor is first in the list.
$editor = $enabled[$preference];
unset($enabled[$preference]);
array_unshift($enabled, $editor);
}
// now find some plugin that supports format and is available
$editor = false;
foreach ($enabled as $e) {
if (!$e->supported_by_browser()) {
// bad luck, this editor is not compatible
continue;
}
if (!($supports = $e->get_supported_formats())) {
// buggy editor!
continue;
}
if (is_null($format) || in_array($format, $supports)) {
// editor supports this format, yay!
$editor = $e;
break;
}
}
if (!$editor) {
$editor = get_texteditor('textarea');
// must exist and can edit anything
}
return $editor;
}
示例2: definition
/**
* Define the form.
*/
public function definition()
{
global $CFG, $COURSE;
$mform = $this->_form;
$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->addHelpButton('preference_htmleditor', 'textediting');
$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);
}
$this->add_action_buttons(true, get_string('savechanges'));
}
示例3: test_get_preferred_editor
/**
* Tests the installation of event handlers from file
*/
public function test_get_preferred_editor()
{
// Fake a user agent.
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.21 5 Safari/534.10';
$enabled = editors_get_enabled();
// Array assignment is always a clone.
$editors = $enabled;
$first = array_shift($enabled);
// Get the default editor which should be the first in the list.
set_user_preference('htmleditor', '');
$preferred = editors_get_preferred_editor();
$this->assertEquals($first, $preferred);
foreach ($editors as $key => $editor) {
// User has set a preference for a specific editor.
set_user_preference('htmleditor', $key);
$preferred = editors_get_preferred_editor();
$this->assertEquals($editor, $preferred);
}
}
示例4: generate_user_settings
//.........这里部分代码省略.........
if (has_capability('moodle/user:editprofile', $usercontext) && !is_siteadmin($user) || $currentuser && has_capability('moodle/user:editownprofile', $systemcontext)) {
if ($userauthplugin && $userauthplugin->can_edit_profile()) {
$url = $userauthplugin->edit_profile_url();
if (empty($url)) {
$url = new moodle_url('/user/edit.php', array('id' => $user->id, 'course' => $course->id));
}
$useraccount->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
}
}
}
}
// Change password link.
if ($userauthplugin && $currentuser && !\core\session\manager::is_loggedinas() && !isguestuser() && has_capability('moodle/user:changeownpassword', $systemcontext) && $userauthplugin->can_change_password()) {
$passwordchangeurl = $userauthplugin->change_password_url();
if (empty($passwordchangeurl)) {
$passwordchangeurl = new moodle_url('/login/change_password.php', array('id' => $course->id));
}
$useraccount->add(get_string("changepassword"), $passwordchangeurl, self::TYPE_SETTING, null, 'changepassword');
}
if (isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) {
if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) {
$url = new moodle_url('/user/language.php', array('id' => $user->id, 'course' => $course->id));
$useraccount->add(get_string('preferredlanguage'), $url, self::TYPE_SETTING, null, 'preferredlanguage');
}
}
$pluginmanager = core_plugin_manager::instance();
$enabled = $pluginmanager->get_enabled_plugins('mod');
if (isset($enabled['forum']) && isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) {
if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) {
$url = new moodle_url('/user/forum.php', array('id' => $user->id, 'course' => $course->id));
$useraccount->add(get_string('forumpreferences'), $url, self::TYPE_SETTING);
}
}
$editors = editors_get_enabled();
if (count($editors) > 1) {
if (isloggedin() && !isguestuser($user) && !is_mnet_remote_user($user)) {
if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) {
$url = new moodle_url('/user/editor.php', array('id' => $user->id, 'course' => $course->id));
$useraccount->add(get_string('editorpreferences'), $url, self::TYPE_SETTING);
}
}
}
// Add "Course preferences" link.
if (isloggedin() && !isguestuser($user)) {
if ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) || has_capability('moodle/user:editprofile', $usercontext)) {
$url = new moodle_url('/user/course.php', array('id' => $user->id, 'course' => $course->id));
$useraccount->add(get_string('coursepreferences'), $url, self::TYPE_SETTING, null, 'coursepreferences');
}
}
// View the roles settings.
if (has_any_capability(array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage'), $usercontext)) {
$roles = $usersetting->add(get_string('roles'), null, self::TYPE_SETTING);
$url = new moodle_url('/admin/roles/usersroles.php', array('userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('thisusersroles', 'role'), $url, self::TYPE_SETTING);
$assignableroles = get_assignable_roles($usercontext, ROLENAME_BOTH);
if (!empty($assignableroles)) {
$url = new moodle_url('/admin/roles/assign.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('assignrolesrelativetothisuser', 'role'), $url, self::TYPE_SETTING);
}
if (has_capability('moodle/role:review', $usercontext) || count(get_overridable_roles($usercontext, ROLENAME_BOTH)) > 0) {
$url = new moodle_url('/admin/roles/permissions.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('permissions', 'role'), $url, self::TYPE_SETTING);
}
$url = new moodle_url('/admin/roles/check.php', array('contextid' => $usercontext->id, 'userid' => $user->id, 'courseid' => $course->id));
$roles->add(get_string('checkpermissions', 'role'), $url, self::TYPE_SETTING);
}
示例5: useredit_shared_definition
function useredit_shared_definition(&$mform, $editoroptions = null)
{
global $CFG, $USER, $DB;
$user = $DB->get_record('user', array('id' => $USER->id));
useredit_load_preferences($user, false);
$strrequired = get_string('required');
$nameordercheck = new stdClass();
$nameordercheck->firstname = 'a';
$nameordercheck->lastname = 'b';
if (fullname($nameordercheck) == 'b a') {
// See MDL-4325
$mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"');
$mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"');
} else {
$mform->addElement('text', 'firstname', get_string('firstname'), 'maxlength="100" size="30"');
$mform->addElement('text', 'lastname', get_string('lastname'), 'maxlength="100" size="30"');
}
$mform->addRule('firstname', $strrequired, 'required', null, 'client');
$mform->setType('firstname', PARAM_NOTAGS);
$mform->addRule('lastname', $strrequired, 'required', null, 'client');
$mform->setType('lastname', 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&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');
}
$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);
$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();
$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', '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');
//.........这里部分代码省略.........
示例6: can_use_html_editor
/**
* Does the user want and can edit using rich text html editor?
* @todo Deprecate: eradicate completely, replace with something else in the future
* @return bool
*/
function can_use_html_editor()
{
global $USER;
$editors = editors_get_enabled();
if (count($editors) > 1) {
if (empty($USER->htmleditor)) {
return false;
}
}
foreach ($editors as $editor) {
if ($editor->get_preferred_format() == FORMAT_HTML) {
return true;
}
}
return false;
}
示例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&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');
//.........这里部分代码省略.........
示例8: definition
//.........这里部分代码省略.........
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->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->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);
$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->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);
示例9: useredit_shared_definition_preferences
/**
* Adds user preferences elements to user edit form.
*
* @param stdClass $user
* @param moodleform $mform
* @param array|null $editoroptions
* @param array|null $filemanageroptions
*/
function useredit_shared_definition_preferences($user, &$mform, $editoroptions = null, $filemanageroptions = null)
{
global $CFG;
$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', $CFG->defaultpreference_maildisplay);
$choices = array();
$choices['0'] = get_string('textformat');
$choices['1'] = get_string('htmlformat');
$mform->addElement('select', 'mailformat', get_string('emailformat'), $choices);
$mform->setDefault('mailformat', $CFG->defaultpreference_mailformat);
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', $CFG->defaultpreference_maildigest);
$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', $CFG->defaultpreference_autosubscribe);
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', $CFG->defaultpreference_trackforums);
}
$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('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
$mform->setDefault('lang', $CFG->lang);
}
示例10: fullname
if ($mailbox->check_destinataries($destinataries)) {
$usertoid = $userto->id;
$usertoname = fullname($userto);
}
}
$editor = '';
if ($CFG->version >= 2014051200) {
if ($USER->preference) {
if (!empty($USER->preference['htmleditor'])) {
$editor = $USER->preference['htmleditor'];
}
}
}
if (!$editor) {
require_once $CFG->libdir . '/editorlib.php';
$editors = array_keys(editors_get_enabled());
if (count($editors) > 1) {
$editor = array_shift($editors);
}
}
$usercontext = block_jmail_get_context(CONTEXT_USER, $USER->id);
$privatefiles = has_capability('moodle/user:manageownfiles', $usercontext);
$jmailcfg = array('wwwroot' => $CFG->wwwroot, 'courseid' => $course->id, 'sesskey' => sesskey(), 'pagesize' => $mailbox->pagesize, 'cansend' => $mailbox->cansend, 'canapprovemessages' => $mailbox->canapprovemessages, 'canmanagelabels' => $mailbox->canmanagelabels, 'canmanagepreferences' => $mailbox->canmanagepreferences, 'userid' => $USER->id, 'globalinbox' => $mailbox->globalinbox, 'approvemode' => !empty($mailbox->config->approvemode) ? $mailbox->config->approvemode : false, 'usertoid' => $usertoid, 'usertoname' => $usertoname, 'version' => $CFG->version, 'editor' => $editor, 'privatefiles' => $privatefiles);
//$PAGE->requires->js('/lib/editor/tinymce/tiny_mce/3.4.2/tiny_mce.js');
//MDL-34741 switch to YUI2 to 2in3 (2.4 and above)
if ($CFG->version < 2012120300) {
$PAGE->requires->yui2_lib(array('event', 'dragdrop', 'element', 'animation', 'resize', 'layout', 'widget', 'button', 'editor', 'get', 'connection', 'datasource', 'datatable', 'container', 'utilities', 'menu', 'json', 'paginator'));
}
//MDL-34741 switch to YUI2 to 2in3 (2.4 and above)
if ($CFG->version < 2012120300) {
// 2.1, 2.2, 2.3