19declare(strict_types=1);
44 $this->service = $internal_service;
78 public function setResultsOverviewToolbar(
85 $config = $this->getInternalService()->domain()->modeFeatureConfig($survey->
getMode());
86 if ($config->usesAppraisees()) {
89 $this->getApprSelectionComponents($survey,
$user_id)
95 $this->getExportAndPrintComponents($survey,
false, $eval_tpl)
118 $request = $this->service
120 ->evaluation($survey)
123 $gui = $this->service->gui();
125 $ctrl = $gui->ctrl();
126 $ui_fac = $gui->ui()->factory();
128 $config = $this->getInternalService()->domain()->modeFeatureConfig($survey->
getMode());
129 if ($config->usesAppraisees()) {
132 $this->getApprSelectionComponents($survey,
$user_id)
137 "ap" =>
$lng->txt(
"svy_eval_captions_abs_perc"),
138 "a" =>
$lng->txt(
"svy_eval_captions_abs"),
139 "p" =>
$lng->txt(
"svy_eval_captions_perc"),
141 $current_cp = $request->getCP();
143 foreach ($caption_options as $key => $label) {
144 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"cp", $key);
145 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"vw", $request->getVW());
146 $caption_items[] = $ui_fac->button()->shy(
148 $ctrl->getLinkTargetByClass(
"ilSurveyEvaluationGUI",
"evaluationdetails")
152 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"cp", $current_cp);
153 $components[] = $ui_fac->dropdown()->standard($caption_items)
154 ->withLabel($caption_options[$current_cp] ??
$lng->txt(
"svy_eval_captions"));
158 "tc" =>
$lng->txt(
"svy_eval_view_tables_charts"),
159 "t" =>
$lng->txt(
"svy_eval_view_tables"),
160 "c" =>
$lng->txt(
"svy_eval_view_charts"),
162 $current_vw = $request->getVW();
164 foreach ($view_options as $key => $label) {
165 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"vw", $key);
166 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"cp", $request->getCP());
167 $view_items[] = $ui_fac->button()->shy(
169 $ctrl->getLinkTargetByClass(
"ilSurveyEvaluationGUI",
"evaluationdetails")
173 $ctrl->setParameterByClass(
"ilSurveyEvaluationGUI",
"vw", $current_vw);
174 $components[] = $ui_fac->dropdown()->standard($view_items)
175 ->withLabel($view_options[$current_vw] ??
$lng->txt(
"svy_eval_view"));
180 $this->getExportAndPrintComponents($survey,
true, $eval_tpl)
195 $config = $this->getInternalService()->domain()->modeFeatureConfig($survey->
getMode());
196 if ($config->usesAppraisees()) {
199 $this->getApprSelectionComponents($survey,
$user_id)
214 $this->buildExportButtonAndModal($eval_tpl, $details ?
"exportDetailData" :
"exportData");
217 $pv = $this->service->gui()->print()->resultsDetails($survey->
getRefId());
218 $this->service->gui()->ctrl()->setParameterByClass(
219 "ilSurveyEvaluationGUI",
221 $this->service->gui()->evaluation($survey)->request()->getVW()
223 $this->service->gui()->ctrl()->setParameterByClass(
224 "ilSurveyEvaluationGUI",
226 $this->service->gui()->evaluation($survey)->request()->getCP()
228 $modal_elements = $pv->getModalElements(
229 $this->service->gui()->ctrl()->getLinkTargetByClass(
230 "ilSurveyEvaluationGUI",
231 "printResultsDetailsSelection"
235 $pv = $this->service->gui()->print()->resultsOverview($survey->
getRefId());
236 $modal_elements = $pv->getModalElements(
237 $this->service->gui()->ctrl()->getLinkTargetByClass(
238 "ilSurveyEvaluationGUI",
239 "printResultsOverviewSelection"
254 $this->addApprSelectionToToolbar(
267 $ctrl = $this->gui->ctrl();
268 $toolbar = $this->gui->toolbar();
269 $ui_fac = $this->gui->ui()->factory();
270 $ui_ren = $this->gui->ui()->renderer();
271 $ui_request = $this->gui->http()->request();
273 $ctrl->setParameterByClass(
"ilsurveyevaluationgui",
"export_cmd", $export_cmd);
274 $modal = $this->getExportModal();
275 $button = $ui_fac->button()->standard(
278 )->withOnClick($modal->getShowSignal());
280 $toolbar->addComponent($button);
281 if (
"POST" === $ui_request->getMethod()
282 && isset($ui_request->getQueryParams()[
"fallbackCmd"])
283 && $ui_request->getQueryParams()[
"fallbackCmd"] ===
"validateAndSubmitExportForm") {
284 $modal = $modal->withRequest($ui_request);
285 $eval_tpl->
setVariable(
"MODAL", $ui_ren->render($modal->withOnLoad($modal->getShowSignal())));
287 $eval_tpl->
setVariable(
"MODAL", $ui_ren->render($modal));
293 $lng = $this->gui->lng();
294 $ctrl = $this->gui->ctrl();
295 $ui_fac = $this->gui->ui()->factory();
297 $post_url = $ctrl->getFormActionByClass(
"ilsurveyevaluationgui",
"validateAndSubmitExportForm");
299 $inputs[
"export_format"] = $ui_fac->input()->field()->select(
300 $lng->txt(
"filetype"),
307 ->withRequired(
true);
309 $inputs[
"export_label"] = $ui_fac->input()->field()->select(
312 "label_only" =>
$lng->txt(
"export_label_only"),
313 "title_only" =>
$lng->txt(
"export_title_only"),
314 "title_label" =>
$lng->txt(
"export_title_label")
318 ->withRequired(
true);
320 $modal = $ui_fac->modal()->roundtrip(
321 $lng->txt(
"svy_export_format"),
326 ->withSubmitLabel(
$lng->txt(
"export"));
336 $lng = $this->service->gui()->
lng();
337 $ctrl = $this->service->gui()->ctrl();
338 $req = $this->service->gui()->evaluation($survey)->request();
340 $evaluation_manager = $this->service->domain()->evaluation(
343 $req->getAppraiseeId(),
347 if ($evaluation_manager->isMultiParticipantsView()) {
348 $appr_id = $evaluation_manager->getCurrentAppraisee();
354 foreach ($evaluation_manager->getSelectableAppraisees() as $appraisee_usr_id) {
364 $appr = new \ilSelectInputGUI(
$lng->txt(
"survey_360_appraisee"),
"appr_id");
366 $appr->setValue($appr_id);
370 $lng->txt(
"survey_360_select_appraisee"),
372 )->submit()->toToolbar(
false, $toolbar);
385 $a_results = $a_eval->getResults();
387 $ui_factory = $this->service->gui()->ui()->factory();
389 $a_tpl = new \ilTemplate(
390 "tpl.svy_results_details_panel.html",
393 "components/ILIAS/Survey/Evaluation"
396 $question_res = $a_results;
398 if (is_array($question_res)) {
399 $question_res = $question_res[0][1];
403 if (!is_object($question_res)) {
407 $question = $question_res->getQuestion();
409 $qst_title = $question->getTitle();
410 $svy_text = nl2br($question->getQuestiontext());
412 $anchor_id =
"svyrdq" . $question->getId();
413 $title =
"<span id='$anchor_id'>$qst_title</span>";
414 $panel_qst_card = $ui_factory->panel()->sub($title, $ui_factory->legacy()->content($svy_text))
415 ->withFurtherInformation($this->getPanelCard($question_res));
417 $panels[] = $panel_qst_card;
421 $this->getPanelTable(
439 $this->getPanelChart(
445 $panels[] = $ui_factory->panel()->sub(
"", $ui_factory->legacy()->content($a_tpl->get()));
454 $a_results = $a_eval->getResults();
456 $a_tpl = new \ilTemplate(
457 "tpl.svy_results_details_table.html",
460 "components/ILIAS/Survey/Evaluation"
463 if ($request->getShowTable()) {
466 $request->getShowAbsolute(),
467 $request->getShowPercentage()
470 foreach ($grid[
"cols"] as $col) {
471 $a_tpl->setCurrentBlock(
"grid_col_header_bl");
472 $a_tpl->setVariable(
"COL_HEADER", $col);
473 $a_tpl->parseCurrentBlock();
475 foreach ($grid[
"rows"] as $cols) {
476 foreach ($cols as $idx => $col) {
478 $a_tpl->touchBlock(
"grid_col_nowrap_bl");
481 $a_tpl->setCurrentBlock(
"grid_col_bl");
482 $a_tpl->setVariable(
"COL_CAPTION", trim((
string) ($col ??
"")));
483 $a_tpl->parseCurrentBlock();
486 $a_tpl->touchBlock(
"grid_row_bl");
490 return $a_tpl->get();
497 $a_results = $a_eval->getResults();
499 $a_tpl = new \ilTemplate(
500 "tpl.svy_results_details_chart.html",
503 "components/ILIAS/Survey/Evaluation"
505 if ($request->getShowChart()) {
506 $chart = $a_eval->
getChart($a_results);
508 if (is_array($chart)) {
509 if (is_array($chart[1])) {
510 foreach ($chart[1] as $legend_item) {
511 $r = hexdec(substr($legend_item[1], 1, 2));
512 $g = hexdec(substr($legend_item[1], 3, 2));
513 $b = hexdec(substr($legend_item[1], 5, 2));
515 $a_tpl->setCurrentBlock(
"legend_bl");
516 $a_tpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
517 $a_tpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
518 $a_tpl->setVariable(
"LEGEND_COLOR_SVG", $r .
"," . $g .
"," .
$b);
519 $a_tpl->parseCurrentBlock();
526 $a_tpl->setVariable(
"CHART", $chart);
530 return $a_tpl->get();
538 $a_results = $a_eval->getResults();
540 $lng = $this->service->gui()->lng();
542 $a_tpl = new \ilTemplate(
"tpl.svy_results_details_text.html",
true,
true,
"components/ILIAS/Survey/Evaluation");
546 if (array_key_exists(
"", $texts)) {
547 $a_tpl->setVariable(
"TEXT_HEADING",
$lng->txt(
"given_answers"));
548 foreach ($texts[
""] as $item) {
549 $a_tpl->setCurrentBlock(
"text_direct_item_bl");
550 $a_tpl->setVariable(
"TEXT_DIRECT", nl2br(htmlentities($item)));
551 $a_tpl->parseCurrentBlock();
554 $acc = new \ilAccordionGUI();
555 $acc->setId(
"svyevaltxt" . $question->getId());
557 $a_tpl->setVariable(
"TEXT_HEADING",
$lng->txt(
"freetext_answers"));
559 foreach ($texts as $var => $items) {
560 $list = array(
"<ul class=\"small\">");
561 foreach ($items as $item) {
562 $list[] =
"<li>" . nl2br(htmlentities($item)) .
"</li>";
565 $acc->addItem((
string) $var, implode(
"\n", $list));
568 $a_tpl->setVariable(
"TEXT_ACC", $acc->getHTML());
571 return $a_tpl->get();
577 $ui_factory = $this->service->gui()->
ui()->
factory();
578 $lng = $this->service->gui()->lng();
585 $card_table_tpl = new \ilTemplate(
586 "tpl.svy_results_details_card.html",
589 "components/ILIAS/Survey/Evaluation"
597 if ($question_res->
getMedian() !==
null) {
600 if ($question_res->
getMean() !==
null) {
601 $kv[
"arithmetic_mean"] = $question_res->
getMean();
605 foreach ($kv as $key => $value) {
606 $card_table_tpl->setCurrentBlock(
"question_statistics_card");
607 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_KEY",
$lng->txt($key));
608 $card_table_tpl->setVariable(
"QUESTION_STATISTIC_VALUE", $value);
609 $card_table_tpl->parseCurrentBlock();
614 return $ui_factory->card()
615 ->standard($svy_type_title)
617 array($ui_factory->legacy()->content($card_table_tpl->get()))
setVariable($variable, $value='')
Sets a variable value.
Survey internal ui service.
setInternalService(InternalService $internal_service)
getExportAndPrintComponents(\ilObjSurvey $survey, bool $details, \ilTemplate $eval_tpl)
setResultsCompetenceToolbar(\ilObjSurvey $survey, int $user_id)
__construct(InternalGUIService $gui)
getPanelChart(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval)
setResultsParticipantToolbar(\ilObjSurvey $survey, int $user_id)
getSurveySettingsGeneral(\ilObjSurvey $survey)
addApprSelectionToToolbar(\ilObjSurvey $survey, \ilToolbarGUI $toolbar, int $user_id)
setResultsDetailToolbar(\ilObjSurvey $survey, int $user_id, \ilTemplate $eval_tpl)
setValuesFromForm(\ilObjSurvey $survey, \ilPropertyFormGUI $form)
getPanelTable(array $participants, \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval)
getSurveySettingsResults(\ilObjSurvey $survey, InternalGUIService $ui_service)
buildExportButtonAndModal(\ilTemplate $eval_tpl, string $export_cmd)
getPanelCard(\ilSurveyEvaluationResults $question_res)
getPanelText(\ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval, \ilSurveyEvaluationResults $question_res)
getApprSelectionComponents(\ilObjSurvey $survey, int $user_id)
getSurveySettingsReminderTargets(\ilObjSurvey $survey, InternalGUIService $ui_service)
getDetailPanels(array $participants, \ILIAS\Survey\Evaluation\EvaluationGUIRequest $request, \SurveyQuestionEvaluation $a_eval)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getGrid( $a_results, bool $a_abs=true, bool $a_perc=true)
Get grid data.
getTextAnswers($a_results)
Get text answers.
static _getQuestionTypeName(string $type_tag)
Return the translation for a given question type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes commonalities between the different modals.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
catch(\Exception $e) $req