当前位置: 首页>>代码示例>>PHP>>正文


PHP question_attempt::get_current_manual_comment方法代码示例

本文整理汇总了PHP中question_attempt::get_current_manual_comment方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt::get_current_manual_comment方法的具体用法?PHP question_attempt::get_current_manual_comment怎么用?PHP question_attempt::get_current_manual_comment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在question_attempt的用法示例。


在下文中一共展示了question_attempt::get_current_manual_comment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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'));
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:55,代码来源:rendererbase.php


注:本文中的question_attempt::get_current_manual_comment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。