/** * Returns the type of an objectID * @access public * @param string $objectID The objectID * @return string INSTANCEOF_x, else NO */ function getType($objectID) { if ($this->exists($objectID)) { return INSTANCEOF_EVAL; } else { $dbObject = new EvaluationGroupDB(); return $dbObject->getType($objectID); } }
/** * Gets the evaluation id for a object id * @access public * @param string $objectID The object id * @return string The evaluation id or nothing */ function getEvalID($objectID) { if (empty($objectID)) { die("FATAL ERROR in getEvalID ;)"); } $type = EvaluationObjectDB::getType($objectID); # echo "Bekomme: $objectID - $type<br>\n"; switch ($type) { case INSTANCEOF_EVALANSWER: $parentID = EvaluationAnswerDB::getParentID($objectID); break; case INSTANCEOF_EVALQUESTION: $parentID = EvaluationQuestionDB::getParentID($objectID); break; case INSTANCEOF_EVALGROUP: $parentID = EvaluationGroupDB::getParentID($objectID); break; default: return $objectID; } $type = EvaluationObjectDB::getType($parentID); # echo "Leite weiter: $parentID - $type<br>\n"; return EvaluationObjectDB::getEvalID($parentID); }
/** * Loads an evaluationgroup from DB into an object * * @access private * @param object EvaluationGroup &$groupObject The group to load * @throws error */ function load(&$groupObject) { /* load group ---------------------------------------------------------- */ $row = DBManager::get()->fetchOne("\n SELECT * FROM evalgroup\n WHERE evalgroup_id = ?\n ORDER BY position ", array($groupObject->getObjectID())); if (count($row) == 0) { return $this->throwError(1, _("Keine Gruppe mit dieser ID gefunden.")); } $groupObject->setParentID($row['parent_id']); $groupObject->setTitle($row['title']); $groupObject->setText($row['text']); $groupObject->setPosition($row['position']); $groupObject->setChildType($row['child_type']); $groupObject->setMandatory($row['mandatory']); $groupObject->setTemplateID($row['template_id']); /* ----------------------------------------------------------- end: load */ /* load children ------------------------------------------------------- */ if ($groupObject->loadChildren != EVAL_LOAD_NO_CHILDREN) { if ($groupObject->loadChildren == EVAL_LOAD_ONLY_EVALGROUP) { EvaluationGroupDB::addChildren($groupObject); } else { EvaluationGroupDB::addChildren($groupObject); EvaluationQuestionDB::addChildren($groupObject); } } /* ------------------------------------------------------ end: questions */ }