本文整理汇总了PHP中format_text_menu函数的典型用法代码示例。如果您正苦于以下问题:PHP format_text_menu函数的具体用法?PHP format_text_menu怎么用?PHP format_text_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_text_menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_add_field
function display_add_field($recordid = 0)
{
global $CFG, $DB, $OUTPUT;
$text = '';
$format = 0;
if ($recordid) {
if ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) {
$text = $content->content;
$format = $content->content1;
}
}
$str = '<div title="' . $this->field->description . '">';
if (can_use_html_editor()) {
// Show a rich text html editor.
$str .= $this->gen_textarea(true, $text);
$str .= $OUTPUT->help_icon(moodle_help_icon::make("richtext2", get_string("helprichtext"), 'moodle', true));
$str .= '<input type="hidden" name="field_' . $this->field->id . '_content1' . '" value="' . FORMAT_HTML . '" />';
} else {
// Show a normal textarea. Also let the user specify the format to be used.
$str .= $this->gen_textarea(false, $text);
// Get the available text formats for this field.
$formatsForField = format_text_menu();
$str .= '<br />';
$select = html_select($formatsForField, 'field_' . $this->field->id . '_content1', $format);
$select->nothingvalue = '';
$str .= $OUTPUT->select($select);
$str .= $OUTPUT->help_icon(moodle_help_icon::make('textformat', get_string('helpformatting'), 'moodle'));
}
$str .= '</div>';
return $str;
}
示例2: display_add_field
function display_add_field($recordid = 0)
{
global $CFG;
$text = '';
$format = 0;
if ($recordid) {
if ($content = get_record('data_content', 'fieldid', $this->field->id, 'recordid', $recordid)) {
$text = $content->content;
$format = $content->content1;
}
}
$str = '<div title="' . $this->field->description . '">';
if (can_use_richtext_editor()) {
// Show a rich text html editor.
$str .= $this->gen_textarea(true, $text);
$str .= helpbutton("richtext", get_string("helprichtext"), 'moodle', true, true, '', true);
$str .= '<input type="hidden" name="field_' . $this->field->id . '_content1' . '" value="' . FORMAT_HTML . '" />';
} else {
// Show a normal textarea. Also let the user specify the format to be used.
$str .= $this->gen_textarea(false, $text);
// Get the available text formats for this field.
$formatsForField = format_text_menu();
$str .= '<br />';
$str .= choose_from_menu($formatsForField, 'field_' . $this->field->id . '_content1', $format, 'choose', '', '', true);
$str .= helpbutton('textformat', get_string('helpformatting'), 'moodle', true, false, '', true);
}
$str .= '</div>';
return $str;
}
示例3: onQuickFormEvent
/**
* Called by HTML_QuickForm whenever form event is made on this element
*
* @param string $event Name of event
* @param mixed $arg event arguments
* @param object $caller calling object
* @since 1.0
* @access public
* @return mixed
*/
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
case 'createElement':
$menu = format_text_menu();
$this->load($menu);
$this->setHelpButton(array('textformat', get_string('helpformatting')));
break;
case 'updateValue':
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
$value = $this->_findValue($caller->_submitValues);
// Fix for bug #4465 & #5269
// XXX: should we push this to element::onQuickFormEvent()?
if (null === $value && (!$caller->isSubmitted() || !$this->getMultiple())) {
$value = $this->_findValue($caller->_defaultValues);
}
}
if (null !== $value) {
$format = $value;
} else {
$format = FORMAT_MOODLE;
}
if ($this->_useHtmlEditor) {
$this->setValue(array(FORMAT_HTML));
} else {
$this->setValue(array($format));
}
return true;
break;
}
return parent::onQuickFormEvent($event, $arg, $caller);
}
示例4: manual_comment_fields
public function manual_comment_fields(question_attempt $qa, question_display_options $options)
{
$inputname = $qa->get_behaviour_field_name('comment');
$id = $inputname . '_id';
list($commenttext, $commentformat) = $qa->get_current_manual_comment();
$editor = editors_get_preferred_editor($commentformat);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
$commenttext = format_text($commenttext, $commentformat, array('para' => false));
$editor->set_text($commenttext);
$editor->use_editor($id, array('context' => $options->context));
$commenteditor = html_writer::tag('div', html_writer::tag('textarea', s($commenttext), array('id' => $id, 'name' => $inputname, 'rows' => 10, 'cols' => 60)));
$editorformat = '';
if (count($formats) == 1) {
reset($formats);
$editorformat .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $inputname . 'format', 'value' => key($formats)));
} else {
$editorformat = html_writer::start_tag('div', array('class' => 'fitem'));
$editorformat .= html_writer::start_tag('div', array('class' => 'fitemtitle'));
$editorformat .= html_writer::tag('label', get_string('format'), array('for' => 'menu' . $inputname . 'format'));
$editorformat .= html_writer::end_tag('div');
$editorformat .= html_writer::start_tag('div', array('class' => 'felement fhtmleditor'));
$editorformat .= html_writer::select($formats, $inputname . 'format', $commentformat, '');
$editorformat .= html_writer::end_tag('div');
$editorformat .= html_writer::end_tag('div');
}
$comment = html_writer::tag('div', html_writer::tag('div', html_writer::tag('label', get_string('comment', 'question'), array('for' => $id)), array('class' => 'fitemtitle')) . html_writer::tag('div', $commenteditor, array('class' => 'felement fhtmleditor')), array('class' => 'fitem'));
$comment .= $editorformat;
$mark = '';
if ($qa->get_max_mark()) {
$currentmark = $qa->get_current_manual_mark();
$maxmark = $qa->get_max_mark();
$fieldsize = strlen($qa->format_max_mark($options->markdp)) - 1;
$markfield = $qa->get_behaviour_field_name('mark');
$attributes = array('type' => 'text', 'size' => $fieldsize, 'name' => $markfield, 'id' => $markfield);
if (!is_null($currentmark)) {
$attributes['value'] = $currentmark;
}
$a = new stdClass();
$a->max = $qa->format_max_mark($options->markdp);
$a->mark = html_writer::empty_tag('input', $attributes);
$markrange = html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $qa->get_behaviour_field_name('maxmark'), 'value' => $maxmark)) . html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $qa->get_control_field_name('minfraction'), 'value' => $qa->get_min_fraction())) . html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $qa->get_control_field_name('maxfraction'), 'value' => $qa->get_max_fraction()));
$error = $qa->validate_manual_mark($currentmark);
$errorclass = '';
if ($error !== '') {
$erroclass = ' error';
$error = html_writer::tag('span', $error, array('class' => 'error')) . html_writer::empty_tag('br');
}
$mark = html_writer::tag('div', html_writer::tag('div', html_writer::tag('label', get_string('mark', 'question'), array('for' => $markfield)), array('class' => 'fitemtitle')) . html_writer::tag('div', $error . get_string('xoutofmax', 'question', $a) . $markrange, array('class' => 'felement ftext' . $errorclass)), array('class' => 'fitem'));
}
return html_writer::tag('fieldset', html_writer::tag('div', $comment . $mark, array('class' => 'fcontainer clearfix')), array('class' => 'hidden'));
}
示例5: display_add_field
function display_add_field($recordid = 0)
{
global $CFG, $DB, $OUTPUT, $PAGE;
$text = '';
$format = 0;
$str = '<div title="' . $this->field->description . '">';
editors_head_setup();
$options = array();
$options['trusttext'] = false;
$options['forcehttps'] = false;
$options['subdirs'] = false;
$options['maxfiles'] = 0;
$options['maxbytes'] = 0;
$options['changeformat'] = 0;
$options['noclean'] = false;
$itemid = $this->field->id;
$field = 'field_' . $itemid;
if ($recordid && ($content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid)))) {
$text = $content->content;
$format = $content->content1;
$text = clean_text($text, $format);
} else {
if (can_use_html_editor()) {
$format = FORMAT_HTML;
} else {
$format = FORMAT_PLAIN;
}
}
$editor = editors_get_preferred_editor($format);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
$editor->use_editor($field, $options);
$str .= '<div><textarea id="' . $field . '" name="' . $field . '" rows="' . $this->field->param3 . '" cols="' . $this->field->param2 . '">' . s($text) . '</textarea></div>';
$str .= '<div><select name="' . $field . '_content1">';
foreach ($formats as $key => $desc) {
$selected = $format == $key ? 'selected="selected"' : '';
$str .= '<option value="' . s($key) . '" ' . $selected . '>' . $desc . '</option>';
}
$str .= '</select>';
$str .= '</div>';
$str .= '</div>';
return $str;
}
示例6: defined
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package filter
* @subpackage emoticon
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configmulticheckbox('filter_emoticon/formats', get_string('settingformats', 'filter_emoticon'), get_string('settingformats_desc', 'filter_emoticon'), array(FORMAT_HTML => 1, FORMAT_MARKDOWN => 1, FORMAT_MOODLE => 1), format_text_menu()));
}
示例7: data_generate_default_template
data_generate_default_template($data, 'listtemplate');
data_generate_default_template($data, 'addtemplate');
data_generate_default_template($data, 'asearchtemplate');
//Template for advanced searches.
data_generate_default_template($data, 'rsstemplate');
}
editors_head_setup();
$format = FORMAT_HTML;
if ($mode === 'csstemplate' or $mode === 'jstemplate') {
$disableeditor = true;
}
if ($disableeditor) {
$format = FORMAT_PLAIN;
}
$editor = editors_get_preferred_editor($format);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
$options = array();
$options['trusttext'] = false;
$options['forcehttps'] = false;
$options['subdirs'] = false;
$options['maxfiles'] = 0;
$options['maxbytes'] = 0;
$options['changeformat'] = 0;
$options['noclean'] = false;
echo '<form id="tempform" action="templates.php?d=' . $data->id . '&mode=' . $mode . '" method="post">';
echo '<div>';
echo '<input name="sesskey" value="' . sesskey() . '" type="hidden" />';
示例8: toHtml
/**
* Returns HTML for editor form element.
*
* @return string
*/
function toHtml() {
global $CFG, $PAGE, $OUTPUT;
require_once($CFG->dirroot.'/repository/lib.php');
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$ctx = $this->_options['context'];
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
$subdirs = $this->_options['subdirs'];
$maxbytes = $this->_options['maxbytes'];
$areamaxbytes = $this->_options['areamaxbytes'];
$maxfiles = $this->_options['maxfiles'];
$changeformat = $this->_options['changeformat']; // TO DO: implement as ajax calls
$text = $this->_values['text'];
$format = $this->_values['format'];
$draftitemid = $this->_values['itemid'];
// security - never ever allow guest/not logged in user to upload anything
if (isguestuser() or !isloggedin()) {
$maxfiles = 0;
}
$str = $this->_getTabs();
$str .= '<div>';
$editor = editors_get_preferred_editor($format);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
// get filepicker info
//
$fpoptions = array();
if ($maxfiles != 0 ) {
if (empty($draftitemid)) {
// no existing area info provided - let's use fresh new draft area
require_once("$CFG->libdir/filelib.php");
$this->setValue(array('itemid'=>file_get_unused_draft_itemid()));
$draftitemid = $this->_values['itemid'];
}
$args = new stdClass();
// need these three to filter repositories list
$args->accepted_types = array('web_image');
$args->return_types = $this->_options['return_types'];
$args->context = $ctx;
$args->env = 'filepicker';
// advimage plugin
$image_options = initialise_filepicker($args);
$image_options->context = $ctx;
$image_options->client_id = uniqid();
$image_options->maxbytes = $this->_options['maxbytes'];
$image_options->areamaxbytes = $this->_options['areamaxbytes'];
$image_options->env = 'editor';
$image_options->itemid = $draftitemid;
// moodlemedia plugin
$args->accepted_types = array('video', 'audio');
$media_options = initialise_filepicker($args);
$media_options->context = $ctx;
$media_options->client_id = uniqid();
$media_options->maxbytes = $this->_options['maxbytes'];
$media_options->areamaxbytes = $this->_options['areamaxbytes'];
$media_options->env = 'editor';
$media_options->itemid = $draftitemid;
// advlink plugin
$args->accepted_types = '*';
$link_options = initialise_filepicker($args);
$link_options->context = $ctx;
$link_options->client_id = uniqid();
$link_options->maxbytes = $this->_options['maxbytes'];
$link_options->areamaxbytes = $this->_options['areamaxbytes'];
$link_options->env = 'editor';
$link_options->itemid = $draftitemid;
$args->accepted_types = array('.vtt');
$subtitle_options = initialise_filepicker($args);
$subtitle_options->context = $ctx;
$subtitle_options->client_id = uniqid();
$subtitle_options->maxbytes = $this->_options['maxbytes'];
$subtitle_options->areamaxbytes = $this->_options['areamaxbytes'];
$subtitle_options->env = 'editor';
$subtitle_options->itemid = $draftitemid;
$fpoptions['image'] = $image_options;
$fpoptions['media'] = $media_options;
//.........这里部分代码省略.........
示例9: toHtml
function toHtml()
{
global $CFG, $PAGE;
require_once $CFG->dirroot . '/repository/lib.php';
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
}
$ctx = $this->_options['context'];
$id = $this->_attributes['id'];
$elname = $this->_attributes['name'];
$subdirs = $this->_options['subdirs'];
$maxbytes = $this->_options['maxbytes'];
$maxfiles = $this->_options['maxfiles'];
$changeformat = $this->_options['changeformat'];
// TO DO: implement as ajax calls
$text = $this->_values['text'];
$format = $this->_values['format'];
$draftitemid = $this->_values['itemid'];
// security - never ever allow guest/not logged in user to upload anything
if (isguestuser() or !isloggedin()) {
$maxfiles = 0;
}
$str = $this->_getTabs();
$str .= '<div>';
$editor = editors_get_preferred_editor($format);
$strformats = format_text_menu();
$formats = $editor->get_supported_formats();
foreach ($formats as $fid) {
$formats[$fid] = $strformats[$fid];
}
// get filepicker info
//
$fpoptions = array();
if ($maxfiles != 0) {
if (empty($draftitemid)) {
// no existing area info provided - let's use fresh new draft area
require_once "{$CFG->libdir}/filelib.php";
$this->setValue(array('itemid' => file_get_unused_draft_itemid()));
$draftitemid = $this->_values['itemid'];
}
$args = new stdClass();
// need these three to filter repositories list
$args->accepted_types = array('image');
$args->return_types = FILE_INTERNAL | FILE_EXTERNAL;
$args->context = $ctx;
$args->env = 'filepicker';
// advimage plugin
$image_options = initialise_filepicker($args);
$image_options->context = $ctx;
$image_options->client_id = uniqid();
$image_options->maxbytes = $this->_options['maxbytes'];
$image_options->env = 'editor';
$image_options->itemid = $draftitemid;
// moodlemedia plugin
$args->accepted_types = array('video', 'audio');
$media_options = initialise_filepicker($args);
$media_options->context = $ctx;
$media_options->client_id = uniqid();
$media_options->maxbytes = $this->_options['maxbytes'];
$media_options->env = 'editor';
$media_options->itemid = $draftitemid;
// advlink plugin
$args->accepted_types = '*';
$link_options = initialise_filepicker($args);
$link_options->context = $ctx;
$link_options->client_id = uniqid();
$link_options->maxbytes = $this->_options['maxbytes'];
$link_options->env = 'editor';
$link_options->itemid = $draftitemid;
$fpoptions['image'] = $image_options;
$fpoptions['media'] = $media_options;
$fpoptions['link'] = $link_options;
}
//If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation.
if ($editor instanceof tinymce_texteditor && !is_null($this->getAttribute('onchange'))) {
$this->_options['required'] = true;
}
/// print text area - TODO: add on-the-fly switching, size configuration, etc.
$editor->use_editor($id, $this->_options, $fpoptions);
$rows = empty($this->_attributes['rows']) ? 15 : $this->_attributes['rows'];
$cols = empty($this->_attributes['cols']) ? 80 : $this->_attributes['cols'];
//Apply editor validation if required field
$editorrules = '';
if (!is_null($this->getAttribute('onblur')) && !is_null($this->getAttribute('onchange'))) {
$editorrules = 'onblur="' . htmlspecialchars($this->getAttribute('onblur')) . '" onchange="' . htmlspecialchars($this->getAttribute('onchange')) . '"';
}
$str .= '<div><textarea id="' . $id . '" name="' . $elname . '[text]" rows="' . $rows . '" cols="' . $cols . '"' . $editorrules . '>';
$str .= s($text);
$str .= '</textarea></div>';
$str .= '<div>';
if (count($formats) > 1) {
$str .= html_writer::select($formats, $elname . '[format]', $format, false);
} else {
$str .= html_writer::empty_tag('input', array('name' => $elname . '[format]', 'type' => 'hidden', 'value' => array_pop(array_keys($formats))));
}
$str .= '</div>';
// during moodle installation, user area doesn't exist
// so we need to disable filepicker here.
if (!during_initial_install() && empty($CFG->adminsetuppending)) {
// 0 means no files, -1 unlimited
//.........这里部分代码省略.........
示例10: display_submission
//.........这里部分代码省略.........
echo '<script type="text/javascript">' . "\n";
echo 'function setNext(){' . "\n";
echo 'document.submitform.mode.value=\'next\';' . "\n";
echo 'document.submitform.userid.value="' . $nextid . '";' . "\n";
echo '}' . "\n";
echo 'function saveNext(){' . "\n";
echo 'document.submitform.mode.value=\'saveandnext\';' . "\n";
echo 'document.submitform.userid.value="' . $nextid . '";' . "\n";
echo 'document.submitform.saveuserid.value="' . $userid . '";' . "\n";
echo 'document.submitform.menuindex.value = document.submitform.grade.selectedIndex;' . "\n";
echo '}' . "\n";
echo '</script>' . "\n";
echo '<table cellspacing="0" class="feedback ' . $subtype . '" >';
///Start of teacher info row
echo '<tr>';
echo '<td width="35" valign="top" class="picture teacher">';
if ($submission->teacher) {
$teacher = get_record('user', 'id', $submission->teacher);
} else {
global $USER;
$teacher = $USER;
}
print_user_picture($teacher->id, $this->course->id, $teacher->picture);
echo '</td>';
echo '<td class="content">';
echo '<form name="submitform" action="submissions.php?cmid=' . $this->cm->id . '" method="post">';
echo '<input type="hidden" name="offset" value="' . ++$offset . '">';
echo '<input type="hidden" name="userid" value="' . $userid . '" />';
echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
echo '<input type="hidden" name="mode" value="grade" />';
//echo '<input type="hidden" name="tabs" value="required" />';
echo '<input type="hidden" name="menuindex" value="0" />';
//selected menu index
//new hidden field, initialized to -1.
echo '<input type="hidden" name="saveuserid" value="-1" />';
if ($submission->timemarked) {
echo '<div class="from">';
echo '<div class="fullname">' . fullname($teacher, true) . '</div>';
echo '<div class="time">' . userdate($submission->timemarked) . '</div>';
echo '</div>';
}
echo '<div class="grade">' . get_string('grade') . ':';
choose_from_menu(make_grades_menu($this->wqgrade), 'grade', $submission->grade, get_string('nograde'), '', -1);
echo '</div>';
echo '<div class="clearer"></div>';
echo '<br />';
if ($usehtmleditor = can_use_html_editor()) {
$defaultformat = FORMAT_HTML;
$editorfields = '';
} else {
$defaultformat = FORMAT_MOODLE;
}
print_textarea($usehtmleditor, 14, 58, 0, 0, 'submissioncomment', $submission->submissioncomment, $this->course->id);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
} else {
echo '<div align="right" class="format">';
choose_from_menu(format_text_menu(), "format", $submission->format, "");
helpbutton("textformat", get_string("helpformatting"));
echo '</div>';
}
///Print Buttons in Single View
echo '<div class="buttons" align="center">';
echo '<input type="submit" name="submit" value="' . get_string('savechanges') . '" onclick = "document.submitform.menuindex.value = document.submitform.grade.selectedIndex" />';
echo '<input type="submit" name="cancel" value="' . get_string('cancel') . '" />';
//if there are more to be graded.
if ($nextid) {
echo '<input type="submit" name="saveandnext" value="' . get_string('saveandnext') . '" onclick="saveNext()" />';
echo '<input type="submit" name="next" value="' . get_string('next') . '" onclick="setNext();" />';
}
echo '</div>';
echo '</form>';
/*
$customfeedback = $this->custom_feedbackform($submission, true);
if (!empty($customfeedback)) {
echo $customfeedback;
}
*/
echo '</td></tr>';
///End of teacher info row, Start of student info row
echo '<tr>';
echo '<td width="35" valign="top" class="picture user">';
print_user_picture($user->id, $this->course->id, $user->picture);
echo '</td>';
echo '<td class="topic">';
echo '<div class="from">';
echo '<div class="fullname">' . fullname($user, true) . '</div>';
if ($submission->timemodified) {
echo '<div class="time">' . userdate($submission->timemodified) . $this->display_lateness($submission->timemodified, $this->wqtimedue) . '</div>';
}
echo '</div>';
$this->print_user_files($user->id);
echo '</td>';
echo '</tr>';
///End of student info row
echo '</table>';
if ($usehtmleditor) {
use_html_editor();
}
}
示例11: can_use_html_editor
}
if (has_capability('moodle/course:bulkmessaging', $coursecontext)) {
$usehtmleditor = can_use_html_editor();
echo '<div class="buttons"><br />';
echo '<input type="button" id="checkall" value="' . get_string('selectall') . '" /> ';
echo '<input type="button" id="checknone" value="' . get_string('deselectall') . '" /> ';
echo '</div>';
echo '<fieldset class="clearfix">';
echo '<legend class="ftoggler">' . get_string('send_message', 'feedback') . '</legend>';
echo '<div><label for="feedback_subject">' . get_string('subject', 'feedback') . ' </label><input type="text" id="feedback_subject" size="50" maxlength="255" name="subject" value="' . $subject . '" /></div>';
print_textarea($usehtmleditor, 15, 25, 30, 10, "message", $message);
if ($usehtmleditor) {
print_string('formathtml');
echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
} else {
choose_from_menu(format_text_menu(), "format", $format, "");
}
echo '<br /><div class="buttons">';
echo '<input type="submit" name="send_message" value="' . get_string('send', 'feedback') . '" />';
echo '</div>';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<input type="hidden" name="action" value="sendmessage" />';
echo '<input type="hidden" name="id" value="' . $id . '" />';
echo '</fieldset>';
echo '</form>';
//include the needed js
$module = array('name' => 'mod_feedback', 'fullpath' => '/mod/feedback/feedback.js');
$PAGE->requires->js_init_call('M.mod_feedback.init_sendmessage', null, false, $module);
}
}
echo $OUTPUT->box_end();
示例12: format_editor_formats
public static function format_editor_formats($editor, $name, $format)
{
// get the valid formats
$strformats = format_text_menu();
$formatids = $editor->get_supported_formats();
foreach ($formatids as $formatid) {
$formats[$formatid] = $strformats[$formatid];
}
// get label and select element for the formats
$output = '';
$params = array('for' => 'id_' . $name . '_format', 'class' => 'accesshide');
$output .= html_writer::tag('label', get_string('format'), $params);
$output .= html_writer::select($formats, $name . '_format', $format);
// wrap it all in a DIV ... not sure why :-)
return html_writer::tag('div', $output);
}
示例13: view_dates
//.........这里部分代码省略.........
$link2room = ' <a href="itemeditor.php?id=' . $cmid . '&newid=' . $itemid . '">Edit Item</a>';
}
/// this is where we make the reservation or delete reservations
if (isset($subitemid) and $can_edit) {
$orig_res = $main_reservation[$tidx][$jday];
// print_r($orig_res);
// print "UID = $UID<p>";
$value = isset($value) ? $value : $username;
if (isset($edit) and ($can_edit == 2 or $UID == $orig_res->userid)) {
print "<table><tr><td>";
print '<script type="text/javascript" src="http://localhost/moodle/lib/editor/htmlarea.php?id=3"></script>
<script type="text/javascript" src="http://localhost/moodle/lib/editor/lang/en.php"></script>';
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
emoticonhelpbutton("form", "description");
}
echo "</td><td>";
print_textarea($usehtmleditor, 20, 60, 680, 400, "value", $orig_res->value);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
} else {
echo '<div align="right">';
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ': ';
if (!$form->format) {
$form->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $form->format, "");
echo '</div>';
}
print "<script language=\"javascript\" type=\"text/javascript\" defer=\"defer\">\n var config = new HTMLArea.Config();\n config.pageStyle = \"body { background-color: #ffffff; font-family: Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; }\";\n config.killWordOnPaste = true;\n config.fontname = {\n \"Trebuchet\": 'Trebuchet MS,Verdana,Arial,Helvetica,sans-serif',\n \"Arial\": 'arial,helvetica,sans-serif',\n \"Courier New\": 'courier new,courier,monospace',\n \"Georgia\": 'georgia,times new roman,times,serif',\n \"Tahoma\": 'tahoma,arial,helvetica,sans-serif',\n \"Times New Roman\": 'times new roman,times,serif',\n \"Verdana\": 'verdana,arial,helvetica,sans-serif',\n \"Impact\": 'impact',\n \"Wingdings\": 'wingdings'};\n HTMLArea.replaceAll(config);\n </script>";
print '<input type="submit" name="save" value="save" />';
print "</td></tr></table>";
print '<input type="hidden" name="subitemid" value="' . $subitemid . '" />';
print '<input type="hidden" name="tidx" value="' . $tidx . '" />';
print '<input type="hidden" name="jday" value="' . $jday . '" />';
print '<input type="hidden" name="resid" value="' . $resid . '" />';
print "</form>";
return;
}
if (isset($resid) and ($orig_res->userid == $UID or $can_edit == 2)) {
$sql = 'DELETE FROM ' . $CFG->prefix . 'bookings_calendar
WHERE id=' . $resid;
execute_sql($sql, 0);
unset($main_reservation[$tidx][$jday]);
}
unset($res);
if (isset($restore)) {
$res->start = 0;
$value = $orig_res->value;
}
if (isset($delete) and ($orig_res->userid == $UID or $can_edit == 2)) {
if ($orig_res->start != -1) {
$res->start = -1;
$value = $orig_res->value;
unset($delete);
}
}
if (!isset($delete)) {
$res->name = $username;
示例14: make_grading_menu
echo ' : ';
make_grading_menu($brainstorm, 'feedback', @$gradeset->feedback, false);
}
// print a final feedback form
echo '<br/><br/><table width="80%"><tr valign="top"><td><b>' . get_string('feedback') . ':</b></td><td>';
$usehtmleditor = can_use_html_editor();
print_textarea($usehtmleditor, 20, 50, 680, 400, 'teacherfeedback', @$report->feedback);
if (!$usehtmleditor) {
echo '<p align="right">';
helpbutton('textformat', get_string('formattexttype'));
print_string('formattexttype');
echo ": ";
if (empty($report->feedbackformat)) {
$report->feedbackformat = FORMAT_MOODLE;
}
choose_from_menu(format_text_menu(), 'feedbackformat', $report->feedbackformat, '');
} else {
$htmleditorneeded = 1;
}
echo '</td></tr></table>';
// if single grading, print a single grade scale
if ($brainstorm->singlegrade) {
echo '<br/>';
print_string('grade');
echo ' : ';
make_grading_menu($brainstorm, 'grade', @$gradeset->single, false);
}
/// print the submit button
echo '<br/><center>';
echo "<br/><input type=\"submit\" name=\"go_btn\" value=\"" . get_string('update') . '" />';
/// end form
示例15: defined
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* @package plugintype
* @subpackage pluginname
* @copyright 2010 David Mudrak <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configmulticheckbox('filter_urltolink/formats', get_string('settingformats', 'filter_urltolink'), get_string('settingformats_desc', 'filter_urltolink'), array(FORMAT_MOODLE => 1), format_text_menu()));
$settings->add(new admin_setting_configcheckbox('filter_urltolink/embedimages', get_string('embedimages', 'filter_urltolink'), get_string('embedimages_desc', 'filter_urltolink'), 1));
}