本文整理汇总了PHP中use_html_editor函数的典型用法代码示例。如果您正苦于以下问题:PHP use_html_editor函数的具体用法?PHP use_html_editor怎么用?PHP use_html_editor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了use_html_editor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: toHtml
function toHtml()
{
if ($this->_canUseHtmlEditor && !$this->_flagFrozen) {
ob_start();
use_html_editor($this->getName(), '', $this->getAttribute('id'));
$script = ob_get_clean();
} else {
$script = '';
}
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
} else {
return $this->_getTabs() . print_textarea($this->_canUseHtmlEditor, $this->_options['rows'], $this->_options['cols'], $this->_options['width'], $this->_options['height'], $this->getName(), preg_replace("/(\r\n|\n|\r)/", '
', $this->getValue()), $this->_options['course'], true, $this->getAttribute('id')) . $script;
}
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:15,代码来源:htmleditor.php
示例2: show_edit_label
function show_edit_label($item, $usehtmleditor = false)
{
$item->presentation = isset($item->presentation) ? $item->presentation : '';
?>
<table style="display:inline">
<tr><th><?php
print_string('label', 'feedback');
?>
</th></tr>
<tr>
<td>
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "presentation", $item->presentation);
?>
<input type="hidden" id="itemname" name="itemname" value="label" />
</td>
</tr>
</table>
<div style="clear:both"></div>
<?php
if ($usehtmleditor) {
use_html_editor();
}
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:24,代码来源:lib.php
示例3: print_simple_box_start
}
if (empty($question->image)) {
$question->image = "";
}
if (!isset($question->penalty)) {
$question->penalty = 0.1;
}
if (!isset($question->defaultgrade)) {
$question->defaultgrade = 1;
}
if (empty($question->generalfeedback)) {
$question->generalfeedback = "";
}
// Set up some richtext editing if necessary
if ($usehtmleditor = can_use_richtext_editor()) {
$defaultformat = FORMAT_HTML;
} else {
$defaultformat = FORMAT_MOODLE;
}
if (isset($question->errors)) {
$err = $question->errors;
}
// Print the question editing form
echo '<br />';
print_simple_box_start('center');
require_once 'type/' . $qtype . '/editquestion.php';
print_simple_box_end();
if ($usehtmleditor) {
use_html_editor('questiontext');
}
print_footer($course);
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:question.php
示例4: sesskey
/// Print the appropriate form
if (file_exists($filename)) {
// We are in maintenance mode
echo '<div style="margin-left:auto;margin-right:auto">';
echo '<form action="maintenance.php" method="post">';
echo '<input type="hidden" name="action" value="disable" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<p><input type="submit" value="' . get_string('disable') . '" /></p>';
echo '</form>';
echo '</div>';
} else {
// We are not in maintenance mode
$usehtmleditor = can_use_html_editor();
echo '<div style="text-align:center;margin-left:auto;margin-right:auto">';
echo '<form action="maintenance.php" method="post">';
echo '<div>';
echo '<input type="hidden" name="action" value="enable" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<p><input type="submit" value="' . get_string('enable') . '" /></p>';
echo '<p>' . get_string('optionalmaintenancemessage', 'admin') . ':</p>';
echo '<table><tr><td>';
print_textarea($usehtmleditor, 20, 50, 600, 400, "text");
echo '</td></tr></table>';
echo '</div>';
echo '</form>';
echo '</div>';
if ($usehtmleditor) {
use_html_editor();
}
}
admin_externalpage_print_footer();
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:31,代码来源:maintenance.php
示例5: display_submission
//.........这里部分代码省略.........
echo '<tr>';
echo '<td 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 id="submitform" action="submissions.php" method="post">';
echo '<div>';
// xhtml compatibility - invisiblefieldset was breaking layout here
echo '<input type="hidden" name="offset" value="' . ($offset + 1) . '" />';
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="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"><label for="menugrade">' . get_string('grade') . '</label> ';
choose_from_menu(make_grades_menu($this->assignment->grade), 'grade', $submission->grade, get_string('nograde'), '', -1, false, $disabled);
echo '</div>';
echo '<div class="clearer"></div>';
echo '<div class="finalgrade">' . get_string('finalgrade', 'grades') . ': ' . $grading_info->items[0]->grades[$userid]->str_grade . '</div>';
echo '<div class="clearer"></div>';
if (!empty($CFG->enableoutcomes)) {
foreach ($grading_info->outcomes as $n => $outcome) {
echo '<div class="outcome"><label for="menuoutcome_' . $n . '">' . $outcome->name . '</label> ';
$options = make_grades_menu(-$outcome->scaleid);
if ($outcome->grades[$submission->userid]->locked) {
$options[0] = get_string('nooutcome', 'grades');
echo $options[$outcome->grades[$submission->userid]->grade];
} else {
choose_from_menu($options, 'outcome_' . $n . '[' . $userid . ']', $outcome->grades[$submission->userid]->grade, get_string('nooutcome', 'grades'), '', 0, false, false, 0, 'menuoutcome_' . $n);
}
echo '</div>';
echo '<div class="clearer"></div>';
}
}
$this->preprocess_submission($submission);
if ($disabled) {
echo '<div class="disabledfeedback">' . $grading_info->items[0]->grades[$userid]->str_feedback . '</div>';
} else {
print_textarea($this->usehtmleditor, 14, 58, 0, 0, 'submissioncomment', $submission->submissioncomment, $this->course->id);
if ($this->usehtmleditor) {
echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
} else {
echo '<div 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">';
echo '<input type="submit" name="submit" value="' . get_string('savechanges') . '" onclick = "document.getElementById(\'submitform\').menuindex.value = document.getElementById(\'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 '</div></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 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) . '</div>';
}
echo '</div>';
$this->print_user_files($user->id);
echo '</td>';
echo '</tr>';
///End of student info row
echo '</table>';
if (!$disabled and $this->usehtmleditor) {
use_html_editor();
}
print_footer('none');
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:lib.php
示例6: print_heading
// print the email form START
print_heading($strquickmail);
// error printing
if (isset($form->error)) {
notify($form->error);
if (isset($form->usersfail)) {
$errorstring = '';
if (isset($form->usersfail['emailfail'])) {
$errorstring .= get_string('emailfail', 'block_quickmail') . '<br />';
foreach ($form->usersfail['emailfail'] as $user) {
$errorstring .= $user . '<br />';
}
}
if (isset($form->usersfail['emailstop'])) {
$errorstring .= get_string('emailstop', 'block_quickmail') . '<br />';
foreach ($form->usersfail['emailstop'] as $user) {
$errorstring .= $user . '<br />';
}
}
notice($errorstring, "{$CFG->wwwroot}/course/view.php?id={$course->id}", $course);
}
}
$currenttab = 'compose';
include $CFG->dirroot . '/blocks/quickmail/tabs.php';
print_simple_box_start('center');
require $CFG->dirroot . '/blocks/quickmail/email.html';
print_simple_box_end();
if ($usehtmleditor) {
use_html_editor('message');
}
print_footer($course);
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:31,代码来源:email.php
示例7: print_richedit_javascript
/**
* Legacy function, provided for backward compatability.
* This method now simply calls {@link use_html_editor()}
*
* @deprecated Use {@link use_html_editor()} instead.
* @param string $name Form element to replace with HTMl editor by name
* @todo Finish documenting this function
*/
function print_richedit_javascript($form, $name, $source = 'no')
{
use_html_editor($name);
}
开发者ID:veritech,项目名称:pare-project,代码行数:12,代码来源:deprecatedlib.php
示例8: message_history_link
}
echo '<li>';
message_history_link($user->id, 0, false, '', '', 'both');
echo '</li>';
echo '</ul>';
echo '</div>';
echo '</div>';
// class="userinfo"
echo '<div id="send">';
echo '<form id="editing" method="post" action="discussion.php">';
$usehtmleditor = can_use_html_editor() && get_user_preferences('message_usehtmleditor', 0);
echo '<h1><label for="edit-message">' . get_string('sendmessage', 'message') . '</label></h1>';
echo '<div>';
if ($usehtmleditor) {
print_textarea(true, 8, 34, 100, 100, 'message', $refreshedmessage);
use_html_editor('message', 'formatblock subscript superscript copy cut paste clean undo redo justifyleft justifycenter justifyright justifyfull lefttoright righttoleft insertorderedlist insertunorderedlist outdent indent inserthorizontalrule createanchor nolink inserttable');
echo '<input type="hidden" name="format" value="' . FORMAT_HTML . '" />';
} else {
print_textarea(false, 8, 50, 0, 0, 'message', $refreshedmessage);
echo '<input type="hidden" name="format" value="' . FORMAT_MOODLE . '" />';
}
echo '</div><div>';
echo '<input type="hidden" name="id" value="' . $user->id . '" />';
echo '<input type="hidden" name="start" value="' . $start . '" />';
echo '<input type="hidden" name="noframesjs" value="' . $noframesjs . '" />';
echo '<input type="hidden" name="last" value="' . time() . '" />';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
echo '<input type="submit" value="' . get_string('sendmessage', 'message') . '" /> ';
echo '<input type="submit" name="refresh" value="' . get_string('refresh') . '" />';
echo '<input type="checkbox" name="newonly" id="newonly" ' . ($newonly ? 'checked="checked" ' : '') . '/><label for="newonly">' . get_string('newonlymsg', 'message') . '</label>';
echo '</div>';
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:discussion.php
示例9: nanogong_print_edit_message_form
/**
* Print the edit message form using the given
* NanoGong message object.
**/
function nanogong_print_edit_message_form($id, $nanogong, $nanogong_message)
{
global $CFG, $USER;
if (isstudent($nanogong->course) && $nanogong_message->locked) {
error(get_string("lockerror", "nanogong"), "view.php?id={$id}");
return;
}
$usehtmleditor = can_use_html_editor();
?>
<form method="post">
<center>
<h3><?php
print_string("editmessage", "nanogong");
?>
</h3>
</center>
<?php
print_simple_box_start("center");
?>
<center>
<table cellpadding="5">
<tr valign="top">
<td align="right"><strong><?php
print_string("submitdate", "nanogong");
?>
:</strong></td>
<td align="left"><?php
p(userdate($nanogong_message->timestamp));
?>
</td>
</tr>
<tr valign="top">
<td align="right"><strong><?php
print_string("title", "nanogong");
?>
:</strong></td>
<td align="left"><input id="title" name="title" type="text" maxlength="255" size="80" value="<?php
p($nanogong_message->title);
?>
" /></td>
</tr>
<tr valign="top">
<td align="right"><strong><?php
print_string("audiomessage", "nanogong");
?>
:</strong></td>
<td align="left">
<applet archive="<?php
p("{$CFG->wwwroot}/mod/nanogong/nanogong.jar");
?>
"
id="recorder" name="recorder" code="gong.NanoGong" width="180px" height="40px">
<?php
if ($CFG->slasharguments) {
$url = "{$CFG->wwwroot}/file.php{$nanogong_message->path}";
} else {
$url = "{$CFG->wwwroot}/file.php?file={$nanogong_message->path}";
}
?>
<param name="SoundFileURL" value="<?php
p($url);
?>
" />
<?php
if (!empty($nanogong->color)) {
?>
<param name="Color" value="<?php
p($nanogong->color);
?>
" />
<?php
}
if (!empty($nanogong->maxduration)) {
?>
<param name="MaxDuration" value="<?php
p($nanogong->maxduration);
?>
" />
<?php
}
?>
<param name="ShowTime" value="true" />
</applet></td>
</tr>
<tr valign="top">
<td align="right"><strong><?php
print_string("textmessage", "nanogong");
?>
:</strong></td>
<td align="left" valign="top">
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "message", $nanogong_message->message);
?>
</td>
</tr>
<?php
//.........这里部分代码省略.........
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:locallib.php
示例10: print_string
echo '</p>';
}
?>
<table cellpadding="5" class="generalbox boxaligncenter" border="1">
<tr valign="top">
<td><b><label for="title"><?php
print_string("pagetitle", "lesson");
?>
:</label></b><br />
<input type="text" id="title" name="title" size="80" value="" /></td></tr>
<?php
echo "<tr><td><b>";
echo get_string("pagecontents", "lesson") . ":</b><br />\n";
print_textarea($usehtmleditor, 25, 70, 630, 400, "contents");
if ($usehtmleditor) {
use_html_editor("contents");
}
echo "</td></tr>\n";
switch ($qtype) {
case LESSON_TRUEFALSE:
for ($i = 0; $i < 2; $i++) {
$iplus1 = $i + 1;
echo "<tr><td><b>" . get_string("answer", "lesson") . " {$iplus1}:</b><br />\n";
print_textarea(false, 6, 70, 630, 300, "answer[{$i}]");
echo "</td></tr>\n";
echo "<tr><td><b>" . get_string("response", "lesson") . " {$iplus1}:</b><br />\n";
print_textarea(false, 6, 70, 630, 300, "response[{$i}]");
echo "</td></tr>\n";
echo "<tr><td><b>" . get_string("jump", "lesson") . " {$iplus1}:</b> \n";
if ($i) {
// answers 2, 3, 4... jumpto this page
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:31,代码来源:addpage.php
示例11: print_question_formulation_and_controls
/**
* Format question display
*/
function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options)
{
global $CFG;
require_once $CFG->libdir . '/formslib.php';
$readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
static $htmleditorused = false;
// Print formulation
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
$image = get_question_image($question);
$maxbytes = $question->options->maxbytes;
$showessay = $question->options->essay;
$answers =& $question->options->answers;
$readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
// Only use the rich text editor for the first essay question on a page.
$usehtmleditor = can_use_html_editor() && !$htmleditorused;
$formatoptions = new stdClass();
$formatoptions->noclean = true;
$formatoptions->para = false;
$inputname = $question->name_prefix;
/// set question text and media
$questiontext = format_text($question->questiontext, $question->questiontextformat, $formatoptions, $cmoptions->course);
// get essay response value
if (isset($state->responses[''])) {
$value = stripslashes_safe($state->responses['']);
} else {
$value = "";
}
// essay answer
$answer = '';
if ($showessay) {
if (empty($options->readonly)) {
// the student needs to type in their answer so print out a text editor
$answer = print_textarea($usehtmleditor, 18, 80, 630, 400, $inputname, $value, $cmoptions->course, true);
} else {
// it is read only, so just format the students answer and output it
$safeformatoptions = new stdClass();
$safeformatoptions->para = false;
$answer = format_text($value, FORMAT_MOODLE, $safeformatoptions, $cmoptions->course);
}
}
// set the file input form
$struploadform = upload_print_form_fragment(1, array($question->name_prefix . "file"), null, false, null, 0, $maxbytes, true);
// set file upload feedback and display of uploaded file
$uploadfeedback = '';
if (isset($state->uploadfeedback)) {
$uploadfeedback = $state->uploadfeedback;
}
$struploadedfile = '';
$currentfile = get_student_answer($state->attempt, $question->id);
if ($currentfile) {
$struploadedfile = get_string('answer', 'quiz') . ': ' . $currentfile;
}
// string prompts for form
if ($currentfile) {
$struploadfile = get_string('uploadnew', 'qtype_fileresponse');
} else {
$struploadfile = get_string('uploadafile');
}
$strmaxsize = get_string('maximumupload') . ' ' . display_size($maxbytes);
include "{$CFG->dirroot}/question/type/fileresponse/display.html";
if ($usehtmleditor) {
use_html_editor($inputname);
$htmleditorused = true;
}
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:68,代码来源:questiontype.php
示例12: ewiki_page_edit_form
function ewiki_page_edit_form(&$id, &$data, &$hidden_postdata)
{
global $ewiki_plugins, $ewiki_config, $moodle_format;
$o = '';
#-- previously edited, or db fetched content
if (@$_REQUEST["content"] || @$_REQUEST["version"]) {
$data = array("version" => &$_REQUEST["version"], "content" => &$_REQUEST["content"]);
} else {
if (empty($data["version"])) {
$data["version"] = 1;
}
@($data["content"] .= "");
}
#-- normalize to DOS newlines
$data["content"] = str_replace("\r\n", "\n", $data["content"]);
$data["content"] = str_replace("\r", "\n", $data["content"]);
$data["content"] = str_replace("\n", "\r\n", $data["content"]);
$hidden_postdata["version"] =& $data["version"];
#-- edit textarea/form
// deleted name="ewiki", can not find the reference, and it's breaking xhtml
$o .= ewiki_t("EDIT_FORM_1") . '<form method="post" enctype="multipart/form-data" action="' . ewiki_script("edit", $id) . '" ' . ' accept-charset="' . EWIKI_CHARSET . '">' . "\n";
$o .= '<div>';
#-- additional POST vars
foreach ($hidden_postdata as $name => $value) {
$o .= '<input type="hidden" name="' . $name . '" value="' . $value . '" />' . "\n";
}
($cols = strtok($ewiki_config["edit_box_size"], "x*/,;:")) && ($rows = strtok("x, ")) || ($cols = 70) && ($rows = 15);
global $ewiki_use_editor, $ewiki_editor_content;
$ewiki_editor_content = 1;
if ($ewiki_use_editor) {
ob_start();
$usehtmleditor = can_use_html_editor();
echo '<table><tr><td>';
if ($usehtmleditor) {
//clean and convert before editing
$options = new object();
$options->smiley = false;
$options->filter = false;
$oldtext = format_text(ewiki_format($data["content"]), $moodle_format, $options);
} else {
$oldtext = ewiki_format($data["content"]);
}
print_textarea($usehtmleditor, $rows, $cols, 680, 400, "content", $oldtext);
echo '</td></tr></table>';
if ($usehtmleditor) {
use_html_editor("content");
}
$o .= ob_get_contents();
ob_end_clean();
} else {
##### END MOODLE ADDITION #####
$o .= '<textarea wrap="soft" id="ewiki_content" name="content" rows="' . $rows . '" cols="' . $cols . '">' . s($data["content"]) . "</textarea>" . $GLOBALS["ewiki_t"]["C"]["EDIT_TEXTAREA_RESIZE_JS"];
##### BEGIN MOODLE ADDITION #####
}
##### END MOODLE ADDITION #####
#-- more <input> elements before the submit button
if ($pf_a = $ewiki_plugins["edit_form_insert"]) {
foreach ($pf_a as $pf) {
$o .= $pf($id, $data, $action);
}
}
##### BEGIN MOODLE ADDITION (Cancel Editing into Button) #####
$o .= "\n<br />\n" . '<input type="submit" name="save" value="' . ewiki_t("SAVE") . '" />' . "\n" . '<input type="submit" name="preview" value="' . ewiki_t("PREVIEW") . '" />' . "\n" . '<input type="submit" name="canceledit" value="' . ewiki_t("CANCEL_EDIT") . '" />' . "\n";
# . ' <a href="'. ewiki_script("", $id) . '">' . ewiki_t("CANCEL_EDIT") . '</a>';
##### END MOODLE ADDITION #####
#-- additional form elements
if ($pf_a = $ewiki_plugins["edit_form_append"]) {
foreach ($pf_a as $pf) {
$o .= $pf($id, $data, $action);
}
}
$o .= "\n</div></form>\n";
// . ewiki_t("EDIT_FORM_2"); // MOODLE DELETION
return '<div class="edit-box">' . $o . '</div>';
}
开发者ID:r007,项目名称:PMoodle,代码行数:75,代码来源:ewiki.php
示例13: make_edit
/**
* Creates the screen for editing tasks.
*
* @uses $CFG
* @return string
**/
function make_edit()
{
global $CFG;
$type = optional_param('type', '', PARAM_ALPHA);
$taskaction = optional_param('taskaction', '', PARAM_ALPHA);
$taskid = optional_param('taskid', 0, PARAM_INT);
$output = '';
if (!$this->can_edit()) {
error('You are not authorized to view this page');
}
/// Actions that handle Processing
switch ($taskaction) {
case 'confirmed':
// Confirmation of deletion
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
if (delete_records('block_task_list', 'id', $taskid)) {
// This replaces the ID:
// Anywhere in the list (except the first spot)
// OR at the beginning of the list
// OR the ID is the list and replaces it
$this->config->taskorder = preg_replace("/,{$taskid}\\b|\\b{$taskid},|\\b{$taskid}\\b/", '', $this->config->taskorder);
$this->instance_config_commit();
// Remove from out task list
unset($this->tasks[$taskid]);
$this->set_message(get_string('taskdeleted', 'block_task_list'), 'notifysuccess');
} else {
$this->set_message(get_string('taskdeletefailed', 'block_task_list'));
}
break;
case 'save':
// Saving an add or edit form
if (confirm_sesskey() and data_submitted()) {
$task = new stdClass();
$task->instanceid = $this->instance->id;
$task->type = required_param('type', PARAM_ALPHA);
if ($task->type == 'category') {
$task->name = required_param('taskname', PARAM_TEXT);
} else {
$task->name = required_param('taskname', PARAM_RAW);
}
$task->format = required_param('format', PARAM_INT);
$task->timemodified = time();
if ($id = optional_param('taskid', 0, PARAM_INT)) {
$task->id = $id;
$result = update_record('block_task_list', $task);
} else {
$result = $task->id = insert_record('block_task_list', $task);
if ($task->id) {
if (empty($this->config->taskorder)) {
$this->config->taskorder = $task->id;
} else {
$this->config->taskorder .= ",{$task->id}";
}
// Save the order
$this->instance_config_commit();
}
}
if ($result) {
// Update the tasks object
$this->tasks[$task->id] = $task;
$this->set_message(get_string('taskitemsaved', 'block_task_list'), 'notifysuccess');
} else {
$this->set_message(get_string('taskitemnotsaved', 'block_task_list'));
}
}
break;
}
/// Actions that handle display
switch ($taskaction) {
case 'edit':
// Edit button was pushed
if (!confirm_sesskey()) {
error(get_string('confirmsesskeybad', 'error'));
}
$name = get_field('block_task_list', 'name', 'id', $taskid);
case 'add':
// An option in the add task menu was selected
if (empty($name)) {
$name = '';
}
if ($usehtmleditor = can_use_html_editor()) {
$format = FORMAT_HTML;
$formatstr = get_string('formathtml');
} else {
$format = FORMAT_MOODLE;
$formatstr = get_string('formattext');
}
$addform = '<h2>' . get_string('editingtask', 'block_task_list', get_string($type, 'block_task_list')) . "</h2>\n <form action=\"{$this->baseurl}\" method=\"post\" accept-charset=\"utf-8\">\n <input type=\"hidden\" name=\"taskmode\" value=\"edit\" />\n <input type=\"hidden\" name=\"taskaction\" value=\"save\" />\n <input type=\"hidden\" name=\"taskid\" value=\"{$taskid}\" />\n <input type=\"hidden\" name=\"type\" value=\"{$type}\" />\n <input type=\"hidden\" name=\"format\" value=\"{$format}\" />\n <input type=\"hidden\" name=\"sesskey\" value=\"" . sesskey() . '" />';
if ($type == 'category') {
$addform .= '<strong>' . get_string('name', 'block_task_list') . ': </strong>' . print_textfield('taskname', s($name), get_string('name', 'block_task_list'), 50, 0, true);
} else {
$addform .= print_textarea($usehtmleditor, 10, 65, 0, 0, 'taskname', $name, $this->course->id, true) . "<br />{$formatstr} " . helpbutton('textformat', get_string('helpformatting'), 'moodle', true, false, '', true);
//.........这里部分代码省略.........
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:101,代码来源:block_task_list.php
示例14: print_form
function print_form()
{
global $CFG;
// If the report form has a course. then we'll allow attachments.
$special_inputs = '';
if ($this->courseid) {
$course = get_record('course', 'id', $this->courseid);
$special_inputs = '<input type="hidden" name="id" value="' . $this->courseid . '">
<input type="hidden" name="MAX_FILE_SIZE" value="' . get_max_upload_file_size($CFG->maxbytes, $course->maxbytes) . '">
' . get_string('attachment', 'block_student_gradeviewer') . '
<input type="file" name="attach" size="45"><br/>';
}
echo '<form enctype="multipart/form-data" method="POST">
<div class="report_wrap">
' . print_box_start('generalbox', true) . '
<div class="report_text" style="width: 65%; margin: auto auto;">
<span>' . get_string('body', 'block_student_gradeviewer') . '</span><br/>
' . print_textarea($this->usehtmleditor, 20, 90, null, null, 'report', '', $this->courseid, true) . '
<br/>
<input type="hidden" name="form_submit" value="1">
' . array_reduce($this->users, array($this, 'reduce_ids')) . get_string('kudo', 'block_student_gradeviewer') . print_checkbox('source', 3, false, '', '', '', true) . '<br/>' . $special_inputs . get_string('anonymous', 'block_student_gradeviewer') . print_checkbox('anonymous', 1, false, '', '', '', true) . '<br/>
<input type="submit" value="' . get_string('report', 'block_student_gradeviewer') . '">
</div>
' . print_box_end(true) . '
</div>
</form>';
if ($this->usehtmleditor) {
use_html_editor('report');
}
}
开发者ID:rrusso,项目名称:EARS,代码行数:30,代码来源:lib.php
示例15: setup_end
function setup_end()
{
global $CFG;
include $CFG->dirroot . '/mod/bookings/type/common_end.html';
print_simple_box_end();
if ($this->usehtmleditor) {
use_html_editor();
}
print_footer($this->course);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:10,代码来源:lib.php
示例16: print_questions_and_form
/**
* Prints questions with comment and grade form underneath each question
*
* @return void
* @todo Finish documenting this function
**/
function print_questions_and_form($quiz, $question, $userid, $attemptid, $gradeungraded, $gradenextungraded, $ungraded)
{
global $CFG;
// TODO get the context, and put in proper roles an permissions checks.
$context = NULL;
$questions[$question->id] =& $question;
$usehtmleditor = can_use_richtext_editor();
list($select, $from, $where) = $this->attempts_sql($quiz->id, false, $question->id, $userid, $attemptid, $gradeungraded, $gradenextungraded);
$sort = 'ORDER BY u.firstname, u.lastname, qa.attempt ASC';
if ($gradenextungraded) {
$attempts = get_records_sql($select . $from . $where . $sort, 0, QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE);
} else {
$attempts = get_records_sql($select . $from . $where . $sort);
}
if ($attempts) {
$firstattempt = current($attempts);
$fullname = fullname($firstattempt);
if ($gradeungraded) {
// getting all ungraded attempts
print_heading(get_string('gradingungraded', 'quiz_grading', $ungraded), '', 3);
} else {
if ($gradenextungraded) {
// getting next ungraded attempts
print_heading(get_string('gradingnextungraded', 'quiz_grading', QUIZ_REPORT_DEFAULT_GRADING_PAGE_SIZE), '', 3);
} else {
if ($userid) {
print_heading(get_string('gradinguser', 'quiz_grading', $fullname), '', 3);
} else {
if ($attemptid) {
$a = new object();
$a->fullname = $fullname;
$a->attempt = $firstattempt->attempt;
print_heading(get_string('gradingattempt', 'quiz_grading', $a), '', 3);
} else {
print_heading(get_string('gradingall', 'quiz_grading', count($attempts)), '', 3);
}
}
}
}
// Display the form with one part for each selected attempt
echo '<form method="post" action="report.php">' . '<input type="hidden" name="mode" value="grading" />' . '<input type="hidden" name="q" value="' . $quiz->id . '" />' . '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . '<input type="hidden" name="questionid" value="' . $question->id . '" />';
foreach ($attempts as $attempt) {
// Load the state for this attempt (The questions array was created earlier)
$states = get_question_states($questions, $quiz, $attempt);
// The $states array is indexed by question id but because we are dealing
// with only one question there is only one entry in this array
$state =& $states[$question->id];
$options = quiz_get_reviewoptions($quiz, $attempt, $context);
unset($options->questioncommentlink);
$options->noeditlink = true;
$copy = $state->manualcomment;
$state->manualcomment = '';
$options->readonly = 1;
$gradedclass = question_state_is_graded($state) ? ' class="highlightgraded" ' : '';
$gradedstring = question_state_is_graded($state) ? ' ' . get_string('graded', 'quiz_grading') : '';
$a = new object();
$a->fullname = fullname($attempt, true);
$a->attempt = $attempt->attempt;
// print the user name, attempt count, the question, and some more hidden fields
echo '<div class="boxaligncenter" width="80%" style="clear:left;padding:15px;">';
echo "<span{$gradedclass}>" . get_string('gradingattempt', 'quiz_grading', $a);
echo $gradedstring . "</span>";
print_question($question, $state, '', $quiz, $options);
$prefix = "manualgrades[{$attempt->uniqueid}]";
if (!question_state_is_graded($state)) {
$grade = '';
} else {
$grade = round($state->last_graded->grade, 3);
}
$state->manualcomment = $copy;
include $CFG->dirroot . '/question/comment.html';
echo '</div>';
}
echo '<div class="boxaligncenter"><input type="submit" value="' . get_string('savechanges') . '" /></div>' . '</form>';
if ($usehtmleditor) {
use_html_editor();
}
} else {
notify(get_string('noattemptstoshow', 'quiz'));
}
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:87,代码来源:report.php
示例17: webquest_print_upload_form
function webquest_print_upload_form($webquest)
{
global $CFG;
if (!($course = get_record("course", "id", $webquest->course))) {
error("Course is misconfigured");
}
if (!($cm = get_coursemodule_from_instanc
|
请发表评论