/** * Print the survey evaluation for a selected user * * Print the survey evaluation for a selected user * * @access private */ function evaluationuser() { global $ilAccess, $ilToolbar; if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE); $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen"); } include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser")); if ($this->object->get360Mode()) { $appr_id = $this->getAppraiseeId(); $this->addApprSelectionToToolbar(); } $tabledata = null; if (!$this->object->get360Mode() || $appr_id) { $format = new ilSelectInputGUI("", "export_format"); $format->setOptions(array(self::TYPE_XLS => $this->lng->txt('exp_type_excel'), self::TYPE_SPSS => $this->lng->txt('exp_type_csv'))); $ilToolbar->addInputItem($format); $label = new ilSelectInputGUI("", "export_label"); $label->setOptions(array('label_only' => $this->lng->txt('export_label_only'), 'title_only' => $this->lng->txt('export_title_only'), 'title_label' => $this->lng->txt('export_title_label'))); $ilToolbar->addInputItem($label); include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php"; $button = ilSubmitButton::getInstance(); $button->setCaption("export"); $button->setCommand('exportevaluationuser'); $button->setOmitPreventDoubleSubmission(true); $ilToolbar->addButtonInstance($button); $ilToolbar->addSeparator(); include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php"; $button = ilLinkButton::getInstance(); $button->setCaption("print"); $button->setOnClick("window.print(); return false;"); $button->setOmitPreventDoubleSubmission(true); $ilToolbar->addButtonInstance($button); $finished_ids = null; if ($appr_id) { $finished_ids = $this->object->getFinishedIdsForAppraiseeId($appr_id); if (!sizeof($finished_ids)) { $finished_ids = array(-1); } } $userResults =& $this->object->getUserSpecificResults($finished_ids); $questions =& $this->object->getSurveyQuestions(true); $participants =& $this->object->getSurveyParticipants($finished_ids); $tabledata = array(); $counter = -1; foreach ($participants as $data) { $questioncounter = 1; $question = ""; $results = ""; $first = true; foreach ($questions as $question_id => $question_data) { $found = $userResults[$question_id][$data["active_id"]]; $text = ""; if (is_array($found)) { $text = implode("<br />", $found); } else { $text = $found; } if (strlen($text) == 0) { $text = ilObjSurvey::getSurveySkippedValue(); } $wt = $this->object->getWorkingtimeForParticipant($data['active_id']); if ($first) { if ($data["finished"]) { $finished = $data["finished_tstamp"]; } else { $finished = false; } $tabledata[++$counter] = array('username' => $data["sortname"], 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => $wt, 'finished' => $finished); $first = false; } else { $tabledata[$counter]["subitems"][] = array('username' => " ", 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => null, 'finished' => null); } } } } $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print"); $this->tpl->setCurrentBlock("generic_css"); $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css"); $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print"); $this->tpl->parseCurrentBlock(); include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php"; $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->hasAnonymizedResults()); $table_gui->setData($tabledata); $this->tpl->setContent($table_gui->getHTML()); }
/** * Print the survey evaluation for a selected user * * Print the survey evaluation for a selected user * * @access private */ function evaluationuser() { global $ilAccess, $ilLog, $ilToolbar; if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) { ilUtil::sendFailure($this->lng->txt("no_permission"), TRUE); $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen"); } if (!is_array($_POST)) { $_POST = array(); } if (array_key_exists("export_format", $_POST)) { return $this->exportUserSpecificResults($_POST["export_format"], $_POST["export_label"]); } $userResults =& $this->object->getUserSpecificResults(); $questions =& $this->object->getSurveyQuestions(true); $participants =& $this->object->getSurveyParticipants(); $tabledata = array(); foreach ($participants as $data) { $questioncounter = 1; $question = ""; $results = ""; $first = true; foreach ($questions as $question_id => $question_data) { $found = $userResults[$question_id][$data["active_id"]]; $text = ""; if (is_array($found)) { $text = implode("<br />", $found); } else { $text = $found; } if (strlen($text) == 0) { $text = $this->lng->txt("skipped"); } $wt = $this->object->getWorkingtimeForParticipant($data['active_id']); if ($first) { array_push($tabledata, array('username' => $data["sortname"], 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => $wt)); $first = false; } else { array_push($tabledata, array('username' => " ", 'question' => $questioncounter++ . ". " . $question_data["title"], 'results' => $text, 'workingtime' => null)); } } } $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print"); $this->tpl->setCurrentBlock("generic_css"); $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css"); $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print"); $this->tpl->parseCurrentBlock(); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "evaluationuser")); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $format = new ilSelectInputGUI("", "export_format"); $format->setOptions(array("excel" => $this->lng->txt('exp_type_excel'), "csv" => $this->lng->txt('exp_type_csv'))); $ilToolbar->addInputItem($format); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $label = new ilSelectInputGUI("", "export_label"); $label->setOptions(array('label_only' => $this->lng->txt('export_label_only'), 'title_only' => $this->lng->txt('export_title_only'), 'title_label' => $this->lng->txt('export_title_label'))); $ilToolbar->addInputItem($label); $ilToolbar->addFormButton($this->lng->txt("export"), 'evaluationuser'); $ilToolbar->addSeparator(); $ilToolbar->addButton($this->lng->txt("print"), "#", "", "", "onclick=\"javascript:window.print()\""); include_once "./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php"; $table_gui = new ilSurveyResultsUserTableGUI($this, 'evaluationuser', $this->object->getAnonymize()); $table_gui->setData($tabledata); $this->tpl->setContent($table_gui->getHTML()); }