/** * fill row * * @access public * @param * @return */ public function fillRow($data) { $this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDate($data['tstamp'], IL_CAL_UNIX))); $user = ilObjUser::_lookupName($data["user_fi"]); $this->tpl->setVariable("USER", ilUtil::prepareFormOutput(trim($user["title"] . " " . $user["firstname"] . " " . $user["lastname"]))); $title = ""; if ($data["question_fi"] || $data["original_fi"]) { include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $title = assQuestion::_getQuestionTitle($data["question_fi"]); if (strlen($title) == 0) { $title = assQuestion::_getQuestionTitle($data["original_fi"]); } $title = $this->lng->txt("assessment_log_question") . ": " . $title; } $this->tpl->setVariable("MESSAGE", ilUtil::prepareFormOutput($data['logtext']) . (strlen($title) ? " (" . $title . ")" : '')); }
/** * Saves the manual feedback for a question in a test * * @param integer $active_id Active ID of the user * @param integer $question_id Question ID * @param integer $pass Pass number * @param string $feedback The feedback text * @return boolean TRUE if the operation succeeds, FALSE otherwise * @access public */ function saveManualFeedback($active_id, $question_id, $pass, $feedback) { global $ilDB; $affectedRows = $ilDB->manipulateF("DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $question_id, $pass)); if (strlen($feedback)) { $next_id = $ilDB->nextId('tst_manual_fb'); /** @var ilDB $ilDB */ $result = $ilDB->insert('tst_manual_fb', array('manual_feedback_id' => array('integer', $next_id), 'active_fi' => array('integer', $active_id), 'question_fi' => array('integer', $question_id), 'pass' => array('integer', $pass), 'feedback' => array('clob', ilRTE::_replaceMediaObjectImageSrc($feedback, 0)), 'tstamp' => array('integer', time()))); include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php"; if (ilObjAssessmentFolder::_enabledAssessmentLogging()) { global $lng, $ilUser; include_once "./Modules/Test/classes/class.ilObjTestAccess.php"; $username = ilObjTestAccess::_getParticipantData($active_id); include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $this->logAction(sprintf($lng->txtlng("assessment", "log_manual_feedback", ilObjAssessmentFolder::_getLogLanguage()), $ilUser->getFullname() . " (" . $ilUser->getLogin() . ")", $username, assQuestion::_getQuestionTitle($question_id), $feedback)); } } if (PEAR::isError($result)) { global $ilias; $ilias->raiseError($result->getMessage()); } else { return TRUE; } }
/** * Called when the a log should be exported */ public function exportLogObject() { $from = mktime($_POST['log_from']['time']['h'], $_POST['log_from']['time']['m'], 0, $_POST['log_from']['date']['m'], $_POST['log_from']['date']['d'], $_POST['log_from']['date']['y']); $until = mktime($_POST['log_until']['time']['h'], $_POST['log_until']['time']['m'], 0, $_POST['log_until']['date']['m'], $_POST['log_until']['date']['d'], $_POST['log_until']['date']['y']); $test = $_POST['sel_test']; $csv = array(); $separator = ";"; $row = array($this->lng->txt("assessment_log_datetime"), $this->lng->txt("user"), $this->lng->txt("assessment_log_text"), $this->lng->txt("question")); include_once "./Modules/Test/classes/class.ilObjTest.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $available_tests =& ilObjTest::_getAvailableTests(1); array_push($csv, ilUtil::processCSVRow($row, TRUE, $separator)); $log_output =& $this->object->getLog($from, $until, $test); $users = array(); foreach ($log_output as $key => $log) { if (!array_key_exists($log["user_fi"], $users)) { $users[$log["user_fi"]] = ilObjUser::_lookupName($log["user_fi"]); } $title = ""; if ($log["question_fi"] || $log["original_fi"]) { $title = assQuestion::_getQuestionTitle($log["question_fi"]); if (strlen($title) == 0) { $title = assQuestion::_getQuestionTitle($log["original_fi"]); } $title = $this->lng->txt("assessment_log_question") . ": " . $title; } $csvrow = array(); $date = new ilDateTime($log['tstamp'], IL_CAL_UNIX); array_push($csvrow, $date->get(IL_CAL_FKT_DATE, 'Y-m-d H:i')); array_push($csvrow, trim($users[$log["user_fi"]]["title"] . " " . $users[$log["user_fi"]]["firstname"] . " " . $users[$log["user_fi"]]["lastname"])); array_push($csvrow, trim($log["logtext"])); array_push($csvrow, $title); array_push($csv, ilUtil::processCSVRow($csvrow, TRUE, $separator)); } $csvoutput = ""; foreach ($csv as $row) { $csvoutput .= join($row, $separator) . "\n"; } ilUtil::deliverData($csvoutput, str_replace(" ", "_", "log_" . $from . "_" . $until . "_" . $available_tests[$test]) . ".csv"); }
/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl; $lng->loadLanguageModule("assessment"); include_once "./Modules/Scorm2004/classes/class.ilSCORM2004NodeFactory.php"; $node_object = ilSCORM2004NodeFactory::getInstance($this->slm_object, $a_set["child"], false); $tr_data = $node_object->getObjectives(); // learning objectives foreach ($tr_data as $data) { $this->tpl->setCurrentBlock("objective"); $this->tpl->setVariable("TXT_LEARNING_OBJECTIVE", ilSCORM2004Sco::convertLists($data->getObjectiveID())); $this->tpl->setVariable("IMG_LOBJ", ilUtil::getImagePath("icon_lobj.svg")); $this->tpl->parseCurrentBlock(); } // pages include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php"; include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $childs = $this->tree->getChilds($a_set["child"]); foreach ($childs as $child) { // get question ids include_once "./Services/COPage/classes/class.ilPCQuestion.php"; $qids = ilPCQuestion::_getQuestionIdsForPage("sahs", $child["child"]); if (count($qids) > 0) { // output questions foreach ($qids as $qid) { $this->tpl->setCurrentBlock("question"); //$qtitle = assQuestion::_getTitle($qid); $qtype = assQuestion::_getQuestionType($qid); //$qtext = assQuestion::_getQuestionText($qid); $qtext = assQuestion::_getQuestionTitle($qid); $this->tpl->setVariable("TXT_QUESTION", $qtext); $this->tpl->setVariable("TXT_QTYPE", $lng->txt($qtype)); $this->tpl->setVariable("IMG_QST", ilUtil::getImagePath("icon_tst.svg")); $this->tpl->parseCurrentBlock(); } // output page title $page_title = ilSCORM2004Node::_lookupTitle($child["child"]); $this->tpl->setCurrentBlock("page"); $this->tpl->setVariable("TXT_PAGE_TITLE", $page_title); $this->tpl->setVariable("IMG_PAGE", ilUtil::getImagePath("icon_pg.svg")); $ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $child["child"]); $this->tpl->setVariable("HREF_EDIT_PAGE", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit")); $this->tpl->parseCurrentBlock(); } } // sco title $this->tpl->setVariable("TXT_SCO_TITLE", $a_set["title"]); $this->tpl->setVariable("IMG_SCO", ilUtil::getImagePath("icon_sco.svg")); $ilCtrl->setParameterByClass("ilscorm2004scogui", "obj_id", $a_set["child"]); $this->tpl->setVariable("HREF_EDIT_SCO", $ilCtrl->getLinkTargetByClass("ilscorm2004scogui", "showProperties")); }