[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/question/classes/bank/ -> question_text_row.php (source)

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  
  18  namespace core_question\bank;
  19  
  20  /**
  21   * A column type for the name of the question name.
  22   *
  23   * @copyright  2009 Tim Hunt
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   */
  26  class question_text_row extends row_base {
  27      protected $formatoptions;
  28  
  29      protected function init() {
  30          $this->formatoptions = new \stdClass();
  31          $this->formatoptions->noclean = true;
  32          $this->formatoptions->para = false;
  33      }
  34  
  35      public function get_name() {
  36          return 'questiontext';
  37      }
  38  
  39      protected function get_title() {
  40          return get_string('questiontext', 'question');
  41      }
  42  
  43      protected function display_content($question, $rowclasses) {
  44          $text = question_rewrite_question_preview_urls($question->questiontext, $question->id,
  45                  $question->contextid, 'question', 'questiontext', $question->id,
  46                  $question->contextid, 'core_question');
  47          $text = format_text($text, $question->questiontextformat,
  48                  $this->formatoptions);
  49          if ($text == '') {
  50              $text = '&#160;';
  51          }
  52          echo $text;
  53      }
  54  
  55      public function get_extra_joins() {
  56          return array('qc' => 'JOIN {question_categories} qc ON qc.id = q.category');
  57      }
  58  
  59      public function get_required_fields() {
  60          return array('q.id', 'q.questiontext', 'q.questiontextformat', 'qc.contextid');
  61      }
  62  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1