예제 #1
0
 public function init()
 {
     $this->setName('addquizconcept');
     $form_elements = array();
     //Setup some Validators
     $validatorPositive = new Zend_Validate_GreaterThan(0);
     $validatorLessthan = new Zend_Validate_LessThan(101);
     // Concepts
     $all_concepts = Model_Quiz_Concept::getAll();
     $all_concepts_array = array();
     // Form likes key=>val
     foreach ($all_concepts as $concept) {
         $all_concepts_array[$concept->getID()] = $concept->getName();
     }
     // Form Elements
     $this->addElement('text', 'number_of_questions', array('label' => 'Number of Questions', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array($validatorPositive), 'placeholder' => "eg. 5"));
     $this->addElement('select', 'concept_id', array('label' => 'Concept', 'multiOptions' => $all_concepts_array, 'required' => true));
     $this->addElement('text', 'difficulty_from', array('label' => 'Difficulty (From)', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array($validatorPositive), 'placeholder' => "eg. 1"));
     $this->addElement('text', 'difficulty_to', array('label' => 'Difficulty (To)', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array($validatorPositive), 'placeholder' => "eg. 3"));
     $this->addElement('submit', 'submit', array('label' => 'Add Tested Concept'));
 }
예제 #2
0
 /**
  * Displays the Concepts for a Given Quiz
  * Expects the quiz id as parameter [id]
  *
  * @return void
  * @author Ben Evans
  */
 public function showconceptsAction()
 {
     //Grab the Quiz
     $quiz_id = $this->_getParam("id");
     if (!isset($quiz_id)) {
         throw new Exception("No Quiz Identifier Passed", 3000);
     }
     $quiz = Model_Quiz_Quiz::fromID($quiz_id);
     $this->view->quiz = $quiz;
     $this->view->concepts = Model_Quiz_Concept::getAll();
 }