/** * 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_EVALQUESTION; } else { $dbObject = new EvaluationAnswerDB(); 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); }
/** * Exports the headline * @access public */ function exportHeader() { if (empty($this->filehandle)) { return $this->throwError(1, _("ExportManager::Konnte temporäre Datei nicht öffnen.")); } fputs($this->filehandle, EVALEXPORT_DELIMITER . _("Nummer") . EVALEXPORT_DELIMITER . EVALEXPORT_SEPERATOR); fputs($this->filehandle, EVALEXPORT_DELIMITER . _("Benutzername") . EVALEXPORT_DELIMITER . EVALEXPORT_SEPERATOR); fputs($this->filehandle, EVALEXPORT_DELIMITER . _("Nachname") . EVALEXPORT_DELIMITER . EVALEXPORT_SEPERATOR); fputs($this->filehandle, EVALEXPORT_DELIMITER . _("Vorname") . EVALEXPORT_DELIMITER . EVALEXPORT_SEPERATOR); fputs($this->filehandle, EVALEXPORT_DELIMITER . _("Email") . EVALEXPORT_DELIMITER . EVALEXPORT_SEPERATOR); $db = new EvaluationAnswerDB(); /* for each question -------------------------------------------------- */ foreach ($this->evalquestions as $evalquestion) { $type = $evalquestion->getType(); $residual = ""; /* Questiontype: likert scale -------------------------------------- */ if ($type == EVALQUESTION_TYPE_LIKERT) { $db->addChildren($evalquestion); $header = $evalquestion->getText() . ":"; while ($answer =& $evalquestion->getNextChild()) { if ($answer->isResidual()) { $residual = $evalquestion->getText() . ":" . $answer->getText(); } else { $header .= $answer->getText(); $header .= "(" . $answer->getPosition() . ")"; $header .= ","; } } $header = substr($header, 0, strlen($header) - 1); $this->addCol($header); if (!empty($residual)) { $this->addCol($residual); $this->evalquestions_residual[$evalquestion->getObjectID()] = true; } /* ----------------------------------------------------- end: likert */ /* Questiontype: pol scale ----------------------------------------- */ } elseif ($type == EVALQUESTION_TYPE_POL) { $db->addChildren($evalquestion); $header = $evalquestion->getText() . ":"; $answer = $evalquestion->getNextChild(); $header .= $answer->getText(); $header .= "(" . $answer->getPosition() . ")"; $header .= "-"; while ($answer =& $evalquestion->getNextChild()) { if ($answer->isResidual()) { $residual = $evalquestion->getText() . ":" . $answer->getText(); } else { $last = $answer->getText() . "(" . $answer->getPosition() . ")"; } } $header .= $last; $this->addCol($header); if (!empty($residual)) { $this->addCol($residual); $this->evalquestions_residual[$evalquestion->getObjectID()] = true; } /* -------------------------------------------------------- end: pol */ /* Questiontype: multiple chioice ---------------------------------- */ } elseif ($type == EVALQUESTION_TYPE_MC) { if ($evalquestion->isMultiplechoice()) { $db->addChildren($evalquestion); while ($answer =& $evalquestion->getNextChild()) { $header = $evalquestion->getText(); $header .= ":" . $answer->getText(); $this->addCol($header); } } else { $header = $evalquestion->getText(); $this->addCol($header); } /* --------------------------------------------------------- end: mc */ /* Questiontype: undefined ----------------------------------------- */ } else { return $this->throwError(2, _("ExportManager::Ungültiger Typ.")); } /* -------------------------------------------------- end: undefined */ } /* ---------------------------------------------- end: foreach question */ fputs($this->filehandle, EVALEXPORT_ENDROW); }