本文整理汇总了PHP中can_use_richtext_editor函数的典型用法代码示例。如果您正苦于以下问题:PHP can_use_richtext_editor函数的具体用法?PHP can_use_richtext_editor怎么用?PHP can_use_richtext_editor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_use_richtext_editor函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($courseid = null, $submitted_data = null)
{
// Not tied to a course
if ($courseid) {
$this->courseid = $courseid;
}
// Strip users from that data, if available
if ($submitted_data) {
$ids = $this->get_user_data($submitted_data);
$users = $ids ? get_records_select('block_courseprefs_users', 'id IN (' . implode(',', $ids) . ')') : array();
$this->users = $this->get_section_users($submitted_data) + $users;
}
// Only here if the developers want a customizeed email.
if ($this->usehtmleditor = can_use_richtext_editor()) {
$this->defaultformat = FORMAT_HTML;
} else {
$this->defaultformat = FORMAT_MOODLE;
}
// Users coming here one way or the other.
$this->submit = optional_param('form_submit') ? true : false;
if ($this->submitted()) {
$this->setup_referral($submitted_data);
}
}
示例2: get_string
$cell2 = get_string('nogroupmembers', 'block_quickmail');
} else {
$cell2 = '<table cellpadding="5px">';
$rows = array_chunk($cells, $cols);
foreach ($rows as $row) {
$cell2 .= '<tr><td nowrap="nowrap">' . implode('</td><td nowrap="nowrap">', $row) . '</td></tr>';
}
$cell2 .= '</table>';
}
}
// add the 2 cells to the table
$table->data[] = array($cell1, $selectlinks . $cell2);
}
}
// get the default format
if ($usehtmleditor = can_use_richtext_editor()) {
$defaultformat = FORMAT_HTML;
} else {
$defaultformat = FORMAT_MOODLE;
}
// set up some strings
$readonly = '';
$strchooseafile = get_string('chooseafile', 'resource');
$strquickmail = get_string('blockname', 'block_quickmail');
/// Header setup
if ($course->category) {
$navigation = "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">{$course->shortname}</a> ->";
} else {
$navigation = '';
}
print_header($course->fullname . ': ' . $strquickmail, $course->fullname, "{$navigation} {$strquickmail}", '', '', true);
示例3: question_print_comment_box
function question_print_comment_box($question, $state, $attempt, $url)
{
global $CFG, $QTYPES;
$prefix = 'response';
$usehtmleditor = can_use_richtext_editor();
if (!question_state_is_graded($state) && $QTYPES[$question->qtype]->is_question_manual_graded($question, $attempt->layout)) {
$grade = '';
} else {
$grade = round($state->last_graded->grade, 3);
}
echo '<form method="post" action="' . $url . '">';
include $CFG->dirroot . '/question/comment.html';
echo '<input type="hidden" name="attempt" value="' . $attempt->uniqueid . '" />';
echo '<input type="hidden" name="question" value="' . $question->id . '" />';
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<input type="submit" name="submit" value="' . get_string('save', 'quiz') . '" />';
echo '</form>';
if ($usehtmleditor) {
use_html_editor();
}
}
示例4: 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'));
}
}
示例5: 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)
{
global $CFG, $db;
// grade question specific parameters
$gradeall = optional_param('gradeall', 0, PARAM_INT);
$userid = optional_param('userid', 0, PARAM_INT);
$attemptid = optional_param('attemptid', 0, PARAM_INT);
// TODO get the context, and put in proper roles an permissions checks.
$context = NULL;
$questions[$question->id] =& $question;
$usehtmleditor = can_use_richtext_editor();
$users = get_course_students($quiz->course);
$userids = implode(',', array_keys($users));
// this sql joins the attempts table and the user table
$select = 'SELECT ' . sql_concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')) . ' AS userattemptid,
qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, qa.preview,
u.id AS userid, u.firstname, u.lastname, u.picture ';
$from = 'FROM ' . $CFG->prefix . 'user u LEFT JOIN ' . $CFG->prefix . 'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = ' . $quiz->id . ') ';
if ($gradeall) {
// get all user attempts
$where = 'WHERE u.id IN (' . $userids . ') ';
} else {
if ($userid) {
// get all the attempts for a specific user
$where = 'WHERE u.id=' . $userid . ' ';
} else {
// get a specific attempt
$where = 'WHERE qa.id=' . $attemptid . ' ';
}
}
// ignore previews
$where .= ' AND preview = 0 ';
$where .= 'AND ' . $db->IfNull('qa.attempt', '0') . ' != 0 ';
$where .= 'AND ' . $db->IfNull('qa.timefinish', '0') . ' != 0 ';
$sort = 'ORDER BY u.firstname, u.lastname, qa.attempt ASC';
$attempts = get_records_sql($select . $from . $where . $sort);
// 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="action" value="viewquestion" />' . '<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);
$copy = $state->manualcomment;
$state->manualcomment = '';
$options->readonly = 1;
// print the user name, attempt count, the question, and some more hidden fields
echo '<div class="boxaligncenter" width="80%" style="padding:15px;">' . fullname($attempt, true) . ': ' . get_string('attempt', 'quiz') . $attempt->attempt;
print_question($question, $state, '', $quiz, $options);
$prefix = "manualgrades[{$attempt->uniqueid}]";
$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();
}
}
示例6: print_after_form
function print_after_form()
{
if (can_use_richtext_editor()) {
use_html_editor('field_' . $this->field->id, '', 'field_' . $this->field->id);
}
}