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


PHP html_writer::nonempty_tag方法代码示例

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


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

示例1: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $response = $qa->get_last_qt_data();
     $o = html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $o .= html_writer::start_tag('div', array('id' => 'ablock_' . $question->id, 'class' => 'ablock'));
     $o .= $this->construct_ablock_select($qa, $options);
     $o .= html_writer::end_tag('div');
     if ($this->can_use_drag_and_drop()) {
         $o .= html_writer::tag('div', '', array('class' => 'clearer'));
     }
     if ($qa->get_state() == question_state::$invalid) {
         $o .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror'));
     }
     if ($this->can_use_drag_and_drop()) {
         $initparams = new stdClass();
         $initparams->qid = $question->id;
         $initparams->stemscount = count($question->get_stem_order());
         $initparams->ablockcontent = $this->construct_ablock_dragable($qa, $options);
         $initparams->readonly = $options->readonly;
         $initparams = json_encode($initparams);
         $js = "YAHOO.util.Event.onDOMReady(function(){M.order.Init({$initparams});});";
         $o .= html_writer::script($js);
     }
     return $o;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:26,代码来源:renderer.php

示例2: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $response = $qa->get_last_qt_data();
     $o = html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $o .= html_writer::start_tag('div', array('id' => 'ablock_' . $question->id, 'class' => 'ablock'));
     $o .= $this->construct_ablock_select($qa, $options);
     $o .= html_writer::end_tag('div');
     if ($this->can_use_drag_and_drop()) {
         $o .= html_writer::tag('div', '', array('class' => 'clearer'));
     }
     if ($qa->get_state() == question_state::$invalid) {
         $o .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror'));
     }
     if ($this->can_use_drag_and_drop()) {
         $initparams = new stdClass();
         $initparams->qid = $question->id;
         $initparams->stemscount = count($question->get_stem_order());
         $initparams->ablockcontent = $this->construct_ablock_dragable($qa, $options);
         $initparams->readonly = $options->readonly;
         global $PAGE;
         $PAGE->requires->js_init_call('M.order.Init', array($initparams), FALSE, array('name' => 'order', 'fullpath' => '/question/type/order/order.js', 'requires' => array('yui2-yahoo', 'yui2-event', 'yui2-dom', 'yui2-dragdrop', 'yui2-animation')));
     }
     return $o;
 }
开发者ID:jacac,项目名称:qtype_order,代码行数:25,代码来源:renderer.php

示例3: manual_comment

 public function manual_comment(question_attempt $qa, question_display_options $options)
 {
     if ($options->manualcomment != question_display_options::EDITABLE) {
         return '';
     }
     $question = $qa->get_question();
     return html_writer::nonempty_tag('div', $question->format_text($question->graderinfo, $question->graderinfo, $qa, 'qtype_poodllrecording', 'graderinfo', $question->id), array('class' => 'graderinfo'));
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:8,代码来源:renderer.php

示例4: feedback

 public function feedback(question_attempt $qa, question_display_options $options)
 {
     // If the latest answer was invalid, display an informative message.
     if ($qa->get_state() == question_state::$invalid) {
         return html_writer::nonempty_tag('div', $this->disregarded_info(), array('class' => 'gradingdetails'));
     }
     // Otherwise get the details.
     return $this->render_adaptive_marks($qa->get_behaviour()->get_adaptive_marks(), $options);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:9,代码来源:renderer.php

示例5: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     global $CFG, $PAGE;
     $question = $qa->get_question();
     $questiontext = $question->format_questiontext($qa);
     $uniqid = uniqid();
     $myanswerid = "my_answer" . $uniqid;
     $correctanswerid = "correct_answer" . $uniqid;
     $marvinjsconfig = get_config('qtype_easyomechjs_options');
     $marvinjspath = $marvinjsconfig->path;
     $protocol = (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') ? 'http://' : 'https://';
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/gui/lib/promise-0.1.1.min.js'));
     $PAGE->requires->js(new moodle_url($protocol . $_SERVER['HTTP_HOST'] . $marvinjspath . '/js/marvinjslauncher.js'));
     $result = html_writer::tag('div', $questiontext, array('class' => 'qtext'));
     if ($options->readonly) {
         $result .= html_writer::tag('input', '', array('id' => 'myresponse' . $uniqid, 'type' => 'button', 'value' => 'My Response'));
         $result .= html_writer::tag('input', '', array('id' => 'corresponse' . $uniqid, 'type' => 'button', 'value' => 'Correct Answer'));
         $this->page->requires->js_init_call('M.qtype_easyomechjs.showmyresponse', array($CFG->version, $uniqid));
         $this->page->requires->js_init_call('M.qtype_easyomechjs.showcorresponse', array($CFG->version, $uniqid));
     }
     $toreplaceid = 'applet' . $uniqid;
     $toreplace = html_writer::tag('div', get_string('enablejavaandjavascript', 'qtype_easyomechjs'), array('id' => $toreplaceid, 'class' => 'easyomechjs resizable'));
     $answerlabel = html_writer::tag('span', get_string('answer', 'qtype_easyomechjs', ''), array('class' => 'answerlabel'));
     $result .= html_writer::tag('div', $answerlabel . $toreplace, array('class' => 'ablock'));
     if ($qa->get_state() == question_state::$invalid) {
         $lastresponse = $this->get_last_response($qa);
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($lastresponse), array('class' => 'validationerror'));
     }
     if (!$options->readonly) {
         $question = $qa->get_question();
         $answertemp = $question->get_correct_response();
         $currentanswer = $qa->get_last_qt_var('answer');
         if ($currentanswer != null) {
             $strippedxml = $currentanswer;
         } else {
             $strippedxml = $this->remove_xml_tags($answertemp['answer'], 'MEFlow');
         }
         $strippedanswerid = "stripped_answer" . $uniqid;
         $result .= html_writer::tag('textarea', $strippedxml, array('id' => $strippedanswerid, 'style' => 'display:none;', 'name' => $strippedanswerid));
     }
     if ($options->readonly) {
         $currentanswer = $qa->get_last_qt_var('answer');
         $strippedanswerid = "stripped_answer" . $uniqid;
         $result .= html_writer::tag('textarea', $currentanswer, array('id' => $strippedanswerid, 'style' => 'display:none;', 'name' => $strippedanswerid));
         $answertemp = $question->get_correct_response();
         // Buttons to show correct and user answers - yeah its a hack!
         $result .= html_writer::tag('textarea', $qa->get_last_qt_var('answer'), array('id' => $myanswerid, 'name' => $myanswerid, 'style' => 'display:none;'));
         $result .= html_writer::tag('textarea', $answertemp['answer'], array('id' => $correctanswerid, 'name' => $correctanswerid, 'style' => 'display:none;'));
     }
     $result .= html_writer::tag('div', $this->hidden_fields($qa), array('class' => 'inputcontrol'));
     $this->require_js($toreplaceid, $qa, $options->readonly, $options->correctness, $uniqid);
     return $result;
 }
开发者ID:Kathrin84,项目名称:moodle-qtype_easyomechjs,代码行数:53,代码来源:renderer.php

示例6: formulation_and_controls

 /**
  * Generate the HTML required for a ddmatch question
  *
  * @param $qa question_attempt The question attempt
  * @param $options question_display_options The options for display
  */
 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     // We use the question quite a lot so store a reference to it once.
     $question = $qa->get_question();
     // Put together the basic question text and answer block.
     $output = '';
     $output .= $this->construct_questiontext($question->format_questiontext($qa));
     $output .= $this->construct_answerblock($qa, $question, $options);
     $this->page->requires->string_for_js('draganswerhere', 'qtype_ddmatch');
     $this->page->requires->yui_module('moodle-qtype_ddmatch-dragdrop', 'M.qtype.ddmatch.init_dragdrop', array(array('questionid' => $qa->get_slot(), 'readonly' => $options->readonly)));
     if ($qa->get_state() === question_state::$invalid) {
         $response = $qa->get_last_qt_data();
         $output .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror'));
     }
     return $output;
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:22,代码来源:renderer.php

示例7: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $currentanswer = $qa->get_last_qt_var('answer');
     $inputname = $qa->get_qt_field_name('answer');
     $inputattributes = array('type' => 'text', 'name' => $inputname, 'value' => $currentanswer, 'id' => $inputname, 'size' => 80, 'style' => 'display:none', 'spellcheck' => 'true');
     if ($options->readonly) {
         $inputattributes['readonly'] = 'readonly';
     }
     $feedbackimg = '';
     if ($options->correctness) {
         $answer = $question->get_matching_answer(array('answer' => $currentanswer));
         if ($answer) {
             $fraction = $answer->fraction;
         } else {
             $fraction = 0;
         }
         $inputattributes['class'] = $this->feedback_class($fraction);
         $feedbackimg = $this->feedback_image($fraction);
     }
     $questiontext = $question->format_questiontext($qa);
     $placeholder = false;
     if (preg_match('/_____+/', $questiontext, $matches)) {
         $placeholder = $matches[0];
         $inputattributes['size'] = round(strlen($placeholder) * 1.1);
     }
     $input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;
     if ($placeholder) {
         $inputinplace = html_writer::tag('label', get_string('answer'), array('for' => $inputattributes['id'], 'class' => 'accesshide'));
         $inputinplace .= $input;
         $questiontext = substr_replace($questiontext, $inputinplace, strpos($questiontext, $placeholder), strlen($placeholder));
     }
     $result = html_writer::tag('div', $questiontext, array('class' => 'qtext'));
     if (!$placeholder) {
         $result .= html_writer::start_tag('div', array('class' => 'ablock'));
         $result .= html_writer::tag('label', get_string('answer', 'qtype_shortanswer', html_writer::tag('span', $input, array('class' => 'answer'))), array('for' => $inputattributes['id']));
         $result .= html_writer::end_tag('div');
     }
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $currentanswer)), array('class' => 'validationerror'));
     }
     $formatted = " <link href=\"../../jquery-spellchecker-demo-master/js/lib/redactor/redactor.css\" rel=\"stylesheet\" />\n    <link href=\"../../jquery-spellchecker-demo-master/css/bootstrap.min.css\" rel=\"stylesheet\">\n    <link href=\"../../jquery-spellchecker-demo-master/css/jquery.spellchecker.css\" rel=\"stylesheet\" />\n    <link href=\"../../jquery-spellchecker-demo-master/css/demos.css\" rel=\"stylesheet\" />\n   \n\n<style>\n@import url('//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css');\n \n.warning {margin: 10px 0px; padding:12px;}\n.warning {color: #9F6000; background-color: #FEEFB3; font-weight:normal;}\n.warning i, {margin:10px 22px; font-size:2em;vertical-align:middle;}\n</style>\n\n \n    <style type=\"text/css\">\n    .redactor_toolbar li a.redactor_btn_spellchecker {\n      background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHtSURBVDjLY/j//z8DJZiBKgY49drM9J3idhLEtu+xjvea4nLNqsVspnWr2S6QmF6+Zol2ltpq5QSlmcpxijMxDABp9pjkuMuu28rIpsMi3rLZFKzIus38mm6OuqRxpf41nC5w7rOJd+i1ngnUXGLTbj7Tsskk3rbL8ppZreEu7Ry1mWpJSvHK8Uoz0TWK5U/nYIg8y8rgPsl+l12P1WqgbTPdJtk/AtoWb1CkBdagnqyyWilawVM/Rw/FBQyx540ZGm/eYIg8P43BdYLdSZiEcYXeTJB/TaoNroH8q5OldVIhXE5SKUqhXSNRfZdKvPKVkOrED+L9d/8wN998w+B4XIL40I48K8FQf/O6+7In/7mbb35hsD2qjBKNDLU3ExjKb7pi1Rx61ke89+6fwBVP/jPXXn/HYHlYGiMdMJTe1JJc/PgHQ/X1xQyplznBYuFnmRiiz062nPfof8DSJ/8ZSq8/ZzA9KIEzIQE1Vvuuf/6fufv2M4bgsz4MxVdPui8Cal4C1Jx/+RGDPqpmTANiz7MAvXI+bO2L/5ZzHvzP2Pjif8DCx/8ZMi/fY9DcL0FUUmbwPKkg3Hr7T+WOV//95j/8z5B6/jaD6l4JkvIC0J9FTtPu/2dIPn+PQXG3BFmZiUFzbweDLH7NVMmNAOGld33BRiNUAAAAAElFTkSuQmCC) !important;\n      background-repeat: no-repeat;\n      background-position: center center;\n    }\n    </style>\n\n    <script type=\"text/javascript\">\n      var _gaq = _gaq || [];\n      _gaq.push(['_setAccount', 'UA-1636725-34']);\n      _gaq.push(['_trackPageview']);\n      (function() {\n        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n\n      })();\n    </script>\n\n\n  \n\n      \n   \n\n    <div class=\"container\" id=\"spellarea\" style=\"width: 100%;\">\n \n\n      <div class=\"row-fluid\">\n          \n\n          <div class=\"tab-content\">\n\n<div class=\"warning\"> <i class=\"fa fa-warning\"></i> (Cheque a grafia correta das palavras)</div>\n\n            <div class=\"tab-pane active\" id=\"demo\">\n          <textarea id=\"text-area\" class=\"textarea\" style=\"width:90%\" rows=\"10\">\n           <p id='answer'> Suua Resposta </p>\n          </textarea>\n  </script> \n\n\n\n          </div>\n          <div class=\"tab-pane\" id=\"usage\">\n\n        <p>Include the neccessary files:</p>\n        <pre class=\"prettyprint linenums\">\n&lt;link rel=\"stylesheet\" href=\"redactor/redactor.css\" /&gt;\n&lt;link rel=\"stylesheet\" href=\"jquery.spellchecker.css\" /&gt;\n\n&lt;script src=\"../../jquery-spellchecker-demo-master/js/jquery-1.8.2.min.js\"&gt;&lt;/script&gt;\n&lt;script src=\"../../jquery-spellchecker-demo-master/js/jquery.spellchecker.js\"&gt;&lt;/script&gt;\n&lt;script src=\"../../redactor/redactor.min.js\"&gt;&lt;/script&gt;</pre>\n <p>Add the following CSS:</p>\n        <pre class=\"prettyprint linenums lang-css\">\n.redactor_toolbar li a.redactor_btn_spellchecker {\n  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHtSURBVDjLY/j//z8DJZiBKgY49drM9J3idhLEtu+xjvea4nLNqsVspnWr2S6QmF6+Zol2ltpq5QSlmcpxijMxDABp9pjkuMuu28rIpsMi3rLZFKzIus38mm6OuqRxpf41nC5w7rOJd+i1ngnUXGLTbj7Tsskk3rbL8ppZreEu7Ry1mWpJSvHK8Uoz0TWK5U/nYIg8y8rgPsl+l12P1WqgbTPdJtk/AtoWb1CkBdagnqyyWilawVM/Rw/FBQyx540ZGm/eYIg8P43BdYLdSZiEcYXeTJB/TaoNroH8q5OldVIhXE5SKUqhXSNRfZdKvPKVkOrED+L9d/8wN998w+B4XIL40I48K8FQf/O6+7In/7mbb35hsD2qjBKNDLU3ExjKb7pi1Rx61ke89+6fwBVP/jPXXn/HYHlYGiMdMJTe1JJc/PgHQ/X1xQyplznBYuFnmRiiz062nPfof8DSJ/8ZSq8/ZzA9KIEzIQE1Vvuuf/6fufv2M4bgsz4MxVdPui8Cal4C1Jx/+RGDPqpmTANiz7MAvXI+bO2L/5ZzHvzP2Pjif8DCx/8ZMi/fY9DcL0FUUmbwPKkg3Hr7T+WOV//95j/8z5B6/jaD6l4JkvIC0J9FTtPu/2dIPn+PQXG3BFmZiUFzbweDLH7NVMmNAOGld33BRiNUAAAAAElFTkSuQmCC) !important;\n  background-repeat: no-repeat;\n  background-position: center center;\n}</pre>\n<p>Create the spellchecker plugin and init the Reactor editor:</p>\n\n        <pre class=\"prettyprint linenums\">\n</pre>\n      </div></div></div>\n\n    </div> <!-- /container -->\n\n    <script src=\"../../jquery-spellchecker-demo-master/js/lib/jquery/jquery-1.8.2.min.js\"></script>\n    <script src=\"../../jquery-spellchecker-demo-master/js/lib/redactor/redactor.min.js\"></script>\n    <script src=\"../../jquery-spellchecker-demo-master/js/lib/bootstrap/bootstrap.min.js\"></script>\n    <script src=\"../../jquery-spellchecker-demo-master/js/lib/prettyprint/prettyprint.js\"></script>\n    <script src=\"../../jquery-spellchecker-demo-master/js/jquery.spellchecker.js\"></script>\n\n    <script>\n(function() {\n   var update = function(){\n        try{\n         var answer = document.getElementById(\"answer\").innerHTML.trim();\n\n//      document.getElementById(\"answer\").innerHTML = ' ' +answer;\n//      answer = document.getElementById(\"answer\").innerHTML.trim();\n\n\nvar is_chrome = window.chrome;\nconsole.log(is_chrome);\n \n    if (typeof is_chrome != 'undefined'){\n        //document.getElementById(\"answer\").innerHTML = \" - \";\ndocument.getElementById(\"answer\").innerHTML = ' ' +answer;\nanswer = document.getElementById(\"answer\").innerHTML.trim();\n        }\n\n        var tmp = document.createElement(\"DIV\");\n       tmp.innerHTML = answer;\n         answer = tmp.textContent || tmp.innerText || \"\";\n\n         document.getElementById(\"" . $inputname . "\").value = answer.trim();\n         console.log( answer +\"- \"+answer.length );//document.getElementById(\"" . $inputname . "\").value);\n        \n        } catch (e) {}}\n\n  if ( \$('input[name=\"" . $inputname . "\"]').is('[readonly]') ) {\n         document.getElementById(\"" . $inputname . "\").style.display = \"block\";\n        //window.alert('ok');\n         document.getElementById(\"spellarea\").style.display = \"none\";\n    };\n\n\n\n  if (typeof window.RedactorPlugins === 'undefined') window.RedactorPlugins = {};\n   \n  window.RedactorPlugins.spellchecker = {\n    init: function() {\n      \n      this.addBtn('spellchecker', 'Checar grafia das palavras!', function(obj) {\n       \n        obj.toggle();\n      });\n    },\n    create: function() {\n        //window.alert(document.getElementById(\"text-area\").value);\n      this.spellchecker = new \$.SpellChecker(this.\$editor, {\n\n        lang: 'pt-br',\n        parser: 'html',\n        webservice: {\n          path: \"../webservices/php/SpellChecker.php\",\n          driver: 'pspell'\n        },\n        suggestBox: {\n          position: 'below'\n        }\n      });\n\n    // var answer = document.getElementById(\"answer\").innerHTML;\n        // document.getElementById(\"" . $inputname . "\").value = answer;\n        // console.log( document.getElementById(\"" . $inputname . "\").value);\n        update();\n\n      // Bind spellchecker handler functions\n      this.spellchecker.on('check.success', function() {\n        alert('Sem erros de escrita!');\n      });\n    },\n    toggle: function() {\n      if (!this.spellchecker) {\n        this.setBtnActive('spellchecker');\n        this.create();\n        this.spellchecker.check();\n      } else {\n        this.setBtnInactive('spellchecker');\n        this.spellchecker.destroy();\n        this.spellchecker = null;\n      }\n        //var answer = document.getElementById(\"answer\").innerHTML;\n        //document.getElementById(\"" . $inputname . "\").value = answer;\n        //console.log( document.getElementById(\"" . $inputname . "\").value);\n\n        update();\n        var classname = document.getElementsByClassName(\"words\");\n        var myFunction = function() {\n                setTimeout(function(){\n        update();\n        //var answer = document.getElementById(\"answer\").innerHTML;\n        //document.getElementById(\"" . $inputname . "\").value = answer;\n        //console.log( document.getElementById(\"" . $inputname . "\").value);\n        }, 1000);\n   \n        };\n\n    for(var i=0;i<classname.length;i++){\n        classname[i].addEventListener('click',  myFunction, false);\n    }\n\n   }\n  };\n   \n\n// Init redactor\n  \$('.textarea').redactor({ \n    plugins: ['spellchecker'],\n    blurCallback: function(e)\n    {\n        //var answer = document.getElementById(\"answer\").innerHTML;\n        //console.log(answer);\n        //show();\n        \n \n         //document.getElementById(\"" . $inputname . "\").value = answer;\n        \n        //console.log( document.getElementById(\"" . $inputname . "\").value);\n    },\n    keyupCallback: function(x)\n    {\n        //var answer = document.getElementById(\"answer\").innerHTML;\n        //console.log(answer);\n        //show();\n        \n        update();\n         //document.getElementById(\"" . $inputname . "\").value = answer;\n        \n        //console.log( document.getElementById(\"" . $inputname . "\").value);\n        }\n\n  });\n\n})();\n\n\n\$('.redactor_btn_formatting').remove();\n\$('.redactor_separator').remove();\n\$('.redactor_btn_bold').remove();\n\$('.redactor_btn_italic').remove();\n\$('.redactor_btn_html').remove();\n\$('.redactor_btn_image').remove();\n\$('.redactor_btn_table').remove();\n\$('.redactor_btn_link').remove();\n\$('.redactor_btn_fontcolor').remove();\n\$('.redactor_btn_backcolor').remove();\n\$('.redactor_btn_alignment').remove();\n\$('.redactor_btn_horizontalrule').remove();\n\$('.redactor_btn_deleted').remove();\n\$('.redactor_btn_unorderedlist').remove();\n\$('.redactor_btn_video').remove();\n\$('.redactor_btn_orderedlist').remove();\n\$('.redactor_btn_outdent').remove();\n\$('.redactor_btn_indent').remove();\n \n\n\n\n\n       \n    </script>\n  ";
     $result .= $formatted;
     return $result;
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:45,代码来源:renderer2.php

示例8: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $questiontext = '';
     foreach ($question->textfragments as $i => $fragment) {
         if ($i > 0) {
             $questiontext .= $this->embedded_element($qa, $i, $options);
         }
         $questiontext .= $fragment;
     }
     $result = '';
     $result .= html_writer::tag('div', $question->format_text($questiontext, $question->questiontextformat, $qa, 'question', 'questiontext', $question->id), array('class' => $this->qtext_classname(), 'id' => $this->qtext_id($qa)));
     $result .= $this->post_qtext_elements($qa, $options);
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($qa->get_last_qt_data()), array('class' => 'validationerror'));
     }
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:18,代码来源:rendererbase.php

示例9: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $stemorder = $question->get_stem_order();
     $response = $qa->get_last_qt_data();
     $choices = $this->format_choices($question);
     $result = '';
     $result .= html_writer::tag('div', $question->format_questiontext($qa), array('class' => 'qtext'));
     $result .= html_writer::start_tag('div', array('class' => 'ablock'));
     $result .= html_writer::start_tag('table', array('class' => 'answer'));
     $result .= html_writer::start_tag('tbody');
     $parity = 0;
     $i = 1;
     foreach ($stemorder as $key => $stemid) {
         $result .= html_writer::start_tag('tr', array('class' => 'r' . $parity));
         $fieldname = 'sub' . $key;
         $result .= html_writer::tag('td', $this->format_stem_text($qa, $stemid), array('class' => 'text'));
         $classes = 'control';
         $feedbackimage = '';
         if (array_key_exists($fieldname, $response)) {
             $selected = $response[$fieldname];
         } else {
             $selected = 0;
         }
         $fraction = (int) ($selected && $selected == $question->get_right_choice_for($stemid));
         if ($options->correctness && $selected) {
             $classes .= ' ' . $this->feedback_class($fraction);
             $feedbackimage = $this->feedback_image($fraction);
         }
         $result .= html_writer::tag('td', html_writer::label(get_string('answer', 'qtype_match', $i), 'menu' . $qa->get_qt_field_name('sub' . $key), false, array('class' => 'accesshide')) . html_writer::select($choices, $qa->get_qt_field_name('sub' . $key), $selected, array('0' => 'choose'), array('disabled' => $options->readonly)) . ' ' . $feedbackimage, array('class' => $classes));
         $result .= html_writer::end_tag('tr');
         $parity = 1 - $parity;
         $i++;
     }
     $result .= html_writer::end_tag('tbody');
     $result .= html_writer::end_tag('table');
     $result .= html_writer::end_tag('div');
     // Closes <div class="ablock">.
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($response), array('class' => 'validationerror'));
     }
     return $result;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:43,代码来源:renderer.php

示例10: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     $question = $qa->get_question();
     $currentanswer = array();
     $inputattributes = array();
     $input = array();
     $questiontext = $question->format_questiontext($qa);
     $result = html_writer::tag('div', $questiontext, array('class' => 'qtext'));
     $result .= html_writer::start_tag('div', array('class' => 'ablock'));
     $parameters = explode(',', $question->parameters);
     $result .= html_writer::start_tag('table');
     $result .= html_writer::start_tag('tbody');
     foreach ($parameters as $parameter) {
         $parameter = trim($parameter);
         if (preg_match('/^(\\w+).*(\\[[^]]+\\])$/', $parameter, $matches)) {
             $parameter_name = $matches[1];
             $unity = $matches[2];
         } else {
             $parameter_name = $parameter;
             $unity = '';
         }
         $inputname['param_' . $parameter_name] = $qa->get_qt_field_name('answer_' . $parameter_name);
         $currentanswer['param_' . $parameter_name] = $qa->get_last_qt_var('answer_' . $parameter_name);
         $inputattributes['param_' . $parameter_name] = array('type' => 'text', 'name' => $inputname['param_' . $parameter_name], 'value' => s($currentanswer['param_' . $parameter_name]), 'id' => $inputname['param_' . $parameter_name], 'size' => 20);
         if ($options->readonly) {
             $inputattributes['param_' . $parameter_name]['readonly'] = 'readonly';
         }
         $input['param_' . $parameter_name] = html_writer::empty_tag('input', $inputattributes['param_' . $parameter_name]);
         $result .= html_writer::start_tag('tr');
         $result .= html_writer::tag('td', $parameter . ' : ', array('class' => 'paramname'));
         $result .= html_writer::tag('td', $input['param_' . $parameter_name], array('class' => 'answer'));
         $result .= html_writer::end_tag('tr');
     }
     $result .= html_writer::end_tag('tbody');
     $result .= html_writer::end_tag('table');
     $result .= html_writer::end_tag('div');
     $result .= html_writer::tag('div', '', array('class' => 'clearer'));
     if ($qa->get_state() == question_state::$invalid) {
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $currentanswer)), array('class' => 'validationerror'));
     }
     return $result;
 }
开发者ID:ndunand,项目名称:moodle-qtype_multinumerical,代码行数:42,代码来源:renderer.php

示例11: formulation_and_controls

 /**
  * Generate the display of the formulation part of the question. This is the
  * area that contains the question text, and the controls for students to
  * input their answers. Some question types also embed bits of feedback, for
  * example ticks and crosses, in this area.
  *
  * @param question_attempt $qa the question attempt to display.
  * @param question_display_options $options controls what should and should not be displayed.
  * @return string HTML fragment.
  */
 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     global $CFG, $PAGE;
     $question = $qa->get_question();
     $qtext = $question->format_questiontext($qa);
     $testcases = $question->testcases;
     $examples = array_filter($testcases, function ($tc) {
         return $tc->useasexample;
     });
     if (count($examples) > 0) {
         $qtext .= html_writer::tag('p', 'For example:', array('class' => 'for-example-para'));
         $qtext .= html_writer::start_tag('div', array('class' => 'coderunner-examples'));
         $qtext .= $this->format_examples($examples);
         $qtext .= html_writer::end_tag('div');
     }
     $qtext .= html_writer::start_tag('div', array('class' => 'prompt'));
     $answerprompt = get_string("answer", "quiz") . ': ';
     $qtext .= $answerprompt;
     $qtext .= html_writer::end_tag('div');
     $responsefieldname = $qa->get_qt_field_name('answer');
     $responsefieldid = 'id_' . $responsefieldname;
     $rows = isset($question->answerboxlines) ? $question->answerboxlines : 18;
     $cols = isset($question->answerboxcolumns) ? $question->answerboxcolumns : 100;
     $taattributes = array('class' => 'coderunner-answer edit_code', 'name' => $responsefieldname, 'id' => $responsefieldid, 'cols' => $cols, 'spellcheck' => 'false', 'rows' => $rows);
     if ($options->readonly) {
         $taattributes['readonly'] = 'readonly';
     }
     $currentanswer = $qa->get_last_qt_var('answer');
     $currentrating = $qa->get_last_qt_var('rating', 0);
     $qtext .= html_writer::tag('textarea', s($currentanswer), $taattributes);
     if ($qa->get_state() == question_state::$invalid) {
         $qtext .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $currentanswer)), array('class' => 'validationerror'));
     }
     // Initialise any program-editing JavaScript.
     // Thanks to Ulrich Dangel for incorporating the Ace code editor.
     $PAGE->requires->js_init_call('M.qtype_coderunner.initQuestionTA', array($responsefieldid));
     load_ace_if_required($question, $responsefieldid, constants::USER_LANGUAGE);
     return $qtext;
 }
开发者ID:skatedude007,项目名称:CodeRunner,代码行数:49,代码来源:renderer.php

示例12: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     global $PAGE;
     $question = $qa->get_question();
     if ($question->answerdisplay == "dragdrop") {
         $PAGE->requires->js('/question/type/gapfill/jquery/jquery-1.4.2.js');
         $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.core.min.js');
         $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.widget.min.js');
         $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.mouse.min.js');
         $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.draggable.min.js');
         $PAGE->requires->js('/question/type/gapfill/jquery/ui/jquery.ui.droppable.min.js');
         $PAGE->requires->js('/question/type/gapfill/dragdrop.js');
     }
     $answers = $qa->get_step(0)->get_qt_var('_allanswers');
     $output = '';
     if ($question->answerdisplay == "dragdrop") {
         $ddclass = " draggable answers ";
         $answers = $this->get_answers('dragdrop', $answers);
         foreach ($answers as $value) {
             $output .= '<span class="' . $ddclass . '">' . $value . "</span>&nbsp";
         }
         $output .= "</br></br>";
     }
     $marked_gaps = $question->get_marked_gaps($qa, $options);
     foreach ($question->textfragments as $place => $fragment) {
         if ($place > 0) {
             $output .= $this->embedded_element($qa, $place, $options, $marked_gaps);
         }
         /* format the non entry field parts of the question text, this will also
            ensure images get displayed */
         $output .= $question->format_text($fragment, $question->questiontextformat, $qa, 'question', 'questiontext', $question->id);
     }
     print "<br/>";
     if ($qa->get_state() == question_state::$invalid) {
         $output .= html_writer::nonempty_tag('div', $question->get_validation_error(array('answer' => $output)), array('class' => 'validationerror'));
     }
     return $output;
 }
开发者ID:dthies,项目名称:moodle-qtype_gapfill,代码行数:38,代码来源:renderer.php

示例13: formulation_and_controls

 public function formulation_and_controls(question_attempt $qa, question_display_options $options)
 {
     global $CFG, $PAGE;
     $question = $qa->get_question();
     $questiontext = $question->format_questiontext($qa);
     $placeholder = false;
     if (preg_match('/_____+/', $questiontext, $matches)) {
         $placeholder = $matches[0];
     }
     $toreplaceid = 'applet' . $qa->get_slot();
     $toreplace = html_writer::tag('span', get_string('enablejavascript', 'qtype_jme'), array('id' => $toreplaceid));
     if ($placeholder) {
         $toreplace = html_writer::tag('span', get_string('enablejavascript', 'qtype_jme'), array('class' => 'ablock'));
         $questiontext = substr_replace($questiontext, $toreplace, strpos($questiontext, $placeholder), strlen($placeholder));
     }
     $result = html_writer::tag('div', $questiontext, array('class' => 'qtext'));
     if (!$placeholder) {
         $answerlabel = html_writer::tag('span', get_string('answer', 'qtype_jme', ''), array('class' => 'answerlabel'));
         $result .= html_writer::tag('div', $answerlabel . $toreplace, array('class' => 'ablock'));
     }
     if ($qa->get_state() == question_state::$invalid) {
         $lastresponse = $this->get_last_response($qa);
         $result .= html_writer::nonempty_tag('div', $question->get_validation_error($lastresponse), array('class' => 'validationerror'));
     }
     if ($options->readonly) {
         $currentanswer = $qa->get_last_qt_var('answer');
         if (!$currentanswer) {
             $currentanswer = '';
         }
         $result .= html_writer::tag('div', get_string('youranswer', 'qtype_jme', $currentanswer), array('class' => 'qtext'));
     }
     $result .= html_writer::tag('div', $this->hidden_fields($qa), array('class' => 'inputcontrol'));
     $this->require_js($toreplaceid, $qa, $options->readonly, $options->correctness);
     // Include JSME loader script as an html tag.
     $jsmescript = $CFG->wwwroot . '/question/type/jme/jsme/jsme.nocache.js';
     $result .= html_writer::tag('script', '', array('src' => $jsmescript));
     return $result;
 }
开发者ID:RicardoMaurici,项目名称:moodle-qtype_jme,代码行数:38,代码来源:renderer.php

示例14: manage_messagingoptions

 /**
  * Display the interface for messaging options
  *
  * @param   mixed   $processors         array of objects containing message processors
  * @param   mixed   $providers          array of objects containing message providers
  * @param   mixed   $preferences        array of objects containing current preferences
  * @param   mixed   $defaultpreferences array of objects containing site default preferences
  * @return  string                      The text to render
  */
 public function manage_messagingoptions($processors, $providers, $preferences, $defaultpreferences)
 {
     // Filter out enabled, available system_configured and user_configured processors only.
     $readyprocessors = array_filter($processors, create_function('$a', 'return $a->enabled && $a->configured && $a->object->is_user_configured();'));
     // Start the form.  We're not using mform here because of our special formatting needs ...
     $output = html_writer::start_tag('form', array('method' => 'post', 'class' => 'mform'));
     $output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
     /// Settings table...
     $output .= html_writer::start_tag('fieldset', array('id' => 'providers', 'class' => 'clearfix'));
     $output .= html_writer::nonempty_tag('legend', get_string('providers_config', 'message'), array('class' => 'ftoggler'));
     // Display the messging options table
     $table = new html_table();
     $table->attributes['class'] = 'generaltable';
     $table->data = array();
     $table->head = array('');
     foreach ($readyprocessors as $processor) {
         $table->head[] = get_string('pluginname', 'message_' . $processor->name);
     }
     $number_procs = count($processors);
     // Populate the table with rows
     foreach ($providers as $provider) {
         $preferencebase = $provider->component . '_' . $provider->name;
         $headerrow = new html_table_row();
         $providername = get_string('messageprovider:' . $provider->name, $provider->component);
         $providercell = new html_table_cell($providername);
         $providercell->header = true;
         $providercell->colspan = $number_procs + 1;
         $providercell->attributes['class'] = 'c0';
         $headerrow->cells = array($providercell);
         $table->data[] = $headerrow;
         foreach (array('loggedin', 'loggedoff') as $state) {
             $optionrow = new html_table_row();
             $optionname = new html_table_cell(get_string($state . 'description', 'message'));
             $optionname->attributes['class'] = 'c0';
             $optionrow->cells = array($optionname);
             foreach ($readyprocessors as $processor) {
                 // determine the default setting
                 $permitted = MESSAGE_DEFAULT_PERMITTED;
                 $defaultpreference = $processor->name . '_provider_' . $preferencebase . '_permitted';
                 if (isset($defaultpreferences->{$defaultpreference})) {
                     $permitted = $defaultpreferences->{$defaultpreference};
                 }
                 // If settings are disallowed, just display the message that
                 // the setting is not permitted, if not use user settings or
                 // force them.
                 if ($permitted == 'disallowed') {
                     if ($state == 'loggedoff') {
                         // skip if we are rendering the second line
                         continue;
                     }
                     $cellcontent = html_writer::nonempty_tag('div', get_string('notpermitted', 'message'), array('class' => 'dimmed_text'));
                     $optioncell = new html_table_cell($cellcontent);
                     $optioncell->rowspan = 2;
                     $optioncell->attributes['class'] = 'disallowed';
                 } else {
                     // determine user preferences and use then unless we force
                     // the preferences.
                     $disabled = array();
                     if ($permitted == 'forced') {
                         $checked = true;
                         $disabled['disabled'] = 1;
                     } else {
                         $checked = false;
                         // See if hser has touched this preference
                         if (isset($preferences->{$preferencebase . '_' . $state})) {
                             // User have some preferneces for this state in the database, use them
                             $checked = isset($preferences->{$preferencebase . '_' . $state}[$processor->name]);
                         } else {
                             // User has not set this preference yet, using site default preferences set by admin
                             $defaultpreference = 'message_provider_' . $preferencebase . '_' . $state;
                             if (isset($defaultpreferences->{$defaultpreference})) {
                                 $checked = (int) in_array($processor->name, explode(',', $defaultpreferences->{$defaultpreference}));
                             }
                         }
                     }
                     $elementname = $preferencebase . '_' . $state . '[' . $processor->name . ']';
                     // prepare language bits
                     $processorname = get_string('pluginname', 'message_' . $processor->name);
                     $statename = get_string($state, 'message');
                     $labelparams = array('provider' => $providername, 'processor' => $processorname, 'state' => $statename);
                     $label = get_string('sendingviawhen', 'message', $labelparams);
                     $cellcontent = html_writer::label($label, $elementname, true, array('class' => 'accesshide'));
                     $cellcontent .= html_writer::checkbox($elementname, 1, $checked, '', array_merge(array('id' => $elementname), $disabled));
                     $optioncell = new html_table_cell($cellcontent);
                     $optioncell->attributes['class'] = 'mdl-align';
                 }
                 $optionrow->cells[] = $optioncell;
             }
             $table->data[] = $optionrow;
         }
     }
//.........这里部分代码省略.........
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:renderer.php

示例15: mahara_footer

function mahara_footer()
{
    global $CFG;
    if ($CFG->current_app->hasPrivilege('Student')) {
        $institution = $CFG->current_app->getCurrentUser()->getInstitution();
    }
    if (!$institution) {
        $institution = $CFG->current_app->getInstitution();
    }
    $footer_links = $institution->selectFromMhrTable('config', 'field', 'footerlinks', true);
    $wwwroot = $institution->getAppUrl(false);
    $content = html_writer::start_tag('div', array('id' => 'footer-wrap'));
    $content .= '<div id="footernavleft"><a href="' . $CFG->current_app->getSupportUrl() . '" target="_blank">Technical Support</a></div>';
    $content .= html_writer::start_tag('div', array('id' => 'footernav'));
    if ($pos = strpos($footer_links->value, 'termsandconditions')) {
        $content .= html_writer::nonempty_tag('a', 'Terms and Conditions', array('href' => "{$wwwroot}/terms.php"));
        $content .= html_writer::end_tag('a');
        $content .= "|";
    }
    if ($pos = strpos($footer_links->value, 'privacystatement')) {
        $content .= html_writer::nonempty_tag('a', 'Privacy Statement', array('href' => "{$wwwroot}/privacy.php"));
        $content .= html_writer::end_tag('a');
        $content .= "|";
    }
    if ($pos = strpos($footer_links->value, 'about')) {
        $content .= html_writer::nonempty_tag('a', 'About', array('href' => "{$wwwroot}/about.php"));
        $content .= html_writer::end_tag('a');
        $content .= "|";
    }
    if ($pos = strpos($footer_links->value, 'contactus')) {
        $content .= html_writer::nonempty_tag('a', 'Contact Us', array('href' => "{$wwwroot}/contact.php"));
        $content .= html_writer::end_tag('a');
    }
    $content .= html_writer::end_tag('div');
    $content .= html_writer::start_tag('div', array('id' => 'poweredby'));
    $content .= html_writer::start_tag('a', array('href' => "http://globalclassroom.us"));
    $content .= html_writer::start_tag('img', array('src' => 'https://s3.amazonaws.com/static.globalclassroom.us/marketing/Stratus/poweredby_blk-trans.png', 'alt' => 'powered by global classroom'));
    $content .= html_writer::end_tag('img');
    $content .= html_writer::end_tag('a');
    $content .= html_writer::end_tag('div');
    $content .= html_writer::end_tag('div');
    return $content;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:43,代码来源:lib.php


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