Ejemplo n.º 1
0
    public function __construct($submiturl, $question, $category, $contexts, $formeditable = true) {
        global $SESSION, $CFG, $DB;
        $this->regenerate = true;
        if ("1" == optional_param('reload', '', PARAM_INT)) {
            $this->reload = true;
        } else {
            $this->reload = false;
        }

        $this->used_in_quiz = false;

        if (isset($question->id) && $question->id != 0) {
            $this->savedquestiondisplay = fullclone($question);
            if ($list = $DB->get_records('quiz_question_instances',
                    array('question' => $question->id))) {
                foreach ($list as $key => $li) {
                    $this->nb_of_quiz ++;
                    if ($att = $DB->get_records('quiz_attempts',
                            array('quiz' => $li->quiz, 'preview' => '0'))) {
                        $this->nb_of_attempts += count($att);
                        $this->used_in_quiz = true;
                    }
                }
            }
        }

        parent::__construct($submiturl, $question, $category, $contexts, $formeditable);
    }
Ejemplo n.º 2
0
 public function __construct($submiturl, $question, $category, $contexts, $formeditable = true)
 {
     global $SESSION, $CFG, $DB;
     $this->regenerate = true;
     $this->reload = optional_param('reload', false, PARAM_BOOL);
     $this->usedinquiz = false;
     if (isset($question->id) && $question->id != 0) {
         // TODO MDL-43779 should not have quiz-specific code here.
         $this->savedquestiondisplay = fullclone($question);
         $this->nbofquiz = $DB->count_records('quiz_slots', array('questionid' => $question->id));
         $this->usedinquiz = $this->nbofquiz > 0;
         $this->nbofattempts = $DB->count_records_sql("\n                    SELECT count(1)\n                      FROM {quiz_slots} slot\n                      JOIN {quiz_attempts} quiza ON quiza.quiz = slot.quizid\n                     WHERE slot.questionid = ?\n                       AND quiza.preview = 0", array($question->id));
     }
     parent::__construct($submiturl, $question, $category, $contexts, $formeditable);
 }
 public function __construct($submiturl, $question, $category, $contexts, $formeditable = true)
 {
     $this->question = $question;
     $this->qtypeobj = question_bank::get_qtype('calculatedmulti');
     $this->reload = optional_param('reload', false, PARAM_BOOL);
     if (!$this->reload) {
         // Use database data as this is first pass.
         if (isset($this->question->id)) {
             // Remove prefix #{..}# if exists.
             $this->initialname = $question->name;
             $regs = array();
             if (preg_match('~#\\{([^[:space:]]*)#~', $question->name, $regs)) {
                 $question->name = str_replace($regs[0], '', $question->name);
             }
         }
     }
     parent::__construct($submiturl, $question, $category, $contexts, $formeditable);
 }
Ejemplo n.º 4
0
 public function __construct($submiturl, $question, $category, $contexts, $formeditable = true)
 {
     parent::__construct($submiturl, $question, $category, $contexts, false);
 }