/** * deletes questions * * @access private * @return boolean true (reinits the tree) */ function execCommandDeleteQuestions() { $questions = Request::getArray('questions'); $deleteQuestions = Request::getArray('DeleteQuestions'); $deletecount = 0; for ($i = 0; $i < count($questions); $i++) { $question = new EvaluationQuestion($questions[$i]['questionID'], NULL, EVAL_LOAD_ALL_CHILDREN); // remove any empty questions if ($deleteQuestions[$i]) { $question->delete(); $deletecount++; } } if ($deletecount == "1") { $this->msg[$this->itemID] = "msg§" . _("Es wurde eine Frage gelöscht."); } elseif ($deletecount > 1) { $this->msg[$this->itemID] = "msg§" . sprintf(_("Es wurden %s Fragen gelöscht."), $deletecount); } else { $this->msg[$this->itemID] = "msg§" . _("Es wurde keine Frage gelöscht."); } $this->execCommandUpdateItem(); return true; }
$question->removeChildID($id); } $answer = new EvaluationAnswer(); $answer->setRows(Request::option('template_add_num_answers')); $question->addChild($answer); $lib->setUniqueName($question, $db, $myuserid); $question->save(); $command = ""; break; /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ case "delete": $question = new EvaluationQuestion($template_id, NULL, EVAL_LOAD_ALL_CHILDREN); if ($question->getParentID() == $myuserid) { /* Delete if it is my template */ $question->delete(); } elseif (get_username($question->getParentID()) == "") { /* Remove all answers if it is not a template */ while ($answer = $question->getChild()) { $answer->delete(); } } else { /* Cannot delete templates of other users */ $report = EvalCommon::createReportMessage(_("Keine Berechtigung zum Löschen."), EVAL_PIC_ERROR, EVAL_CSS_ERROR); } $command = ""; break; /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ case "add_answers": // Bevor etwas hinzugefügt wird nochmal die Speicherungsroutine laufen lassen