public function display() { $question_id = array_rand(self::$questions); //Question aléatoire $question = new QuestionCaptchaQuestion(); $question->set_properties(self::$questions[$question_id]); $tpl = new FileTemplate('QuestionCaptcha/QuestionCaptcha.tpl'); $tpl->put_all(array('QUESTION_ID' => $question_id, 'QUESTION' => $question->get_label(), 'HTML_ID' => $this->get_html_id())); return $tpl->render(); }
private function init_questions_array() { $questions = array(); $lang = LangLoader::get('install', 'QuestionCaptcha'); $question = new QuestionCaptchaQuestion(); $question->set_label($lang['question1_label']); $question->set_answers(explode(';', $lang['question1_answers'])); $questions[1] = $question->get_properties(); $question = new QuestionCaptchaQuestion(); $question->set_label($lang['question2_label']); $question->set_answers(explode(';', $lang['question2_answers'])); $questions[2] = $question->get_properties(); return $questions; }