/**
  * Constructor.
  *
  * @param array $real The real question types.
  * @param array $fake The fake question types.
  * @param stdClass $course The course.
  * @param array $hiddenparams Hidden parameters.
  * @param context $context The relevant context.
  */
 public function __construct($real, $fake, $course, $hiddenparams, $context)
 {
     $sections = [];
     $sections[] = new chooser_section('questions', new lang_string('questions', 'question'), array_map(function ($qtype) use($context) {
         return new qbank_chooser_item($qtype, $context);
     }, $real));
     $sections[] = new chooser_section('other', new lang_string('other'), array_map(function ($qtype) use($context) {
         return new qbank_chooser_item($qtype, $context);
     }, $fake));
     parent::__construct(new moodle_url('/question/question.php'), new lang_string('chooseqtypetoadd', 'question'), $sections, 'qtype');
     $this->set_instructions(new lang_string('selectaqtypefordescription', 'question'));
     $this->set_method('get');
     $this->add_param('courseid', $course->id);
     foreach ($hiddenparams as $k => $v) {
         $this->add_param($k, $v);
     }
 }
Exemple #2
0
 /**
  * Export for template.
  *
  * @param renderer_base  The renderer.
  * @return stdClass
  */
 public function export_for_template(renderer_base $output)
 {
     $data = parent::export_for_template($output);
     $data->courseid = $this->course->id;
     return $data;
 }