Ejemplo n.º 1
0
             break;
     }
     break;
 case "create_question_answers":
     $onthefly = 1;
     // extract the questionID from the command
     foreach ($_REQUEST as $key => $value) {
         if (preg_match("/template_(.*)_button?/", $key, $command)) {
             break;
         }
     }
     if (preg_match("/(.*)_#(.*)/", $command[1], $command_parts)) {
         $questionID = $command_parts[2];
     }
     $question = new EvaluationQuestion($questionID, NULL, EVAL_LOAD_ALL_CHILDREN);
     if ($question->getNumberChildren() == 0) {
         $question->setType(EVALQUESTION_TYPE_MC);
         for ($i = 0; $i < 4; $i++) {
             $answer = new EvaluationAnswer();
             $answer->setParentID($question->getObjectID());
             $answer->setText("");
             $answer->setPosition(1);
             $question->addChild($answer);
         }
     }
     $td->cont($lib->createTemplateForm($question, $onthefly));
     break;
 case "createfree_scale":
     $question = new EvaluationQuestion();
     $question->setObjectID(md5(uniqid(rand())));
     $question->setType(EVALQUESTION_TYPE_MC);