70        $this->tabs = 
$DIC->tabs();
 
   71        $this->access = 
$DIC->access();
 
   72        $this->
user = $DIC->user();
 
   73        $this->rbacsystem = 
$DIC->rbac()->system();
 
   74        $this->tree = 
$DIC->repositoryTree();
 
   75        $this->toolbar = 
$DIC->toolbar();
 
   76        $this->ui = 
$DIC->ui();
 
   84        $this->
object = $a_object;
 
   86        $this->array_panels = array();
 
   88        if ($this->object->get360Mode()) {
 
   98        include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
 
  100        if ($this->object->get360SkillService() && $skmg_set->isActivated()) {
 
  101            $cmd = $this->ctrl->getCmd(
"competenceEval");
 
  103            $cmd = $this->ctrl->getCmd(
"evaluation");
 
  106        $next_class = $this->ctrl->getNextClass($this);
 
  109        switch ($next_class) {
 
  111                $this->setEvalSubTabs();
 
  112                $ret =&$this->$cmd();
 
  133        include_once(
"./Services/Skill/classes/class.ilSkillManagementSettings.php");
 
  135        if ($this->object->get360SkillService() && $skmg_set->isActivated()) {
 
  136            $ilTabs->addSubTabTarget(
 
  137                "svy_eval_competences",
 
  138                $this->ctrl->getLinkTarget($this, 
"competenceEval"),
 
  139                array(
"competenceEval")
 
  143        $ilTabs->addSubTabTarget(
 
  144            "svy_eval_cumulated",
 
  145            $this->ctrl->getLinkTarget($this, 
"evaluation"),
 
  146            array(
"evaluation", 
"checkEvaluationAccess")
 
  149        $ilTabs->addSubTabTarget(
 
  151            $this->ctrl->getLinkTarget($this, 
"evaluationdetails"),
 
  152            array(
"evaluationdetails")
 
  155        if ($ilAccess->checkAccess(
"write", 
"", $this->object->getRefId())) {
 
  156            $ilTabs->addSubTabTarget(
 
  158                $this->ctrl->getLinkTarget($this, 
"evaluationuser"),
 
  159                array(
"evaluationuser")
 
  172        $this->appr_id = $a_val;
 
  196        if ($_REQUEST[
"appr_id"] == 
"") {
 
  197            $req_appr_id = 
$ilUser->getId();
 
  199            $req_appr_id = (int) $_REQUEST[
"appr_id"];
 
  203        if ($req_appr_id > 0) {
 
  207            foreach ($this->object->getAppraiseesData() as $item) {
 
  208                if ($item[
"closed"] &&
 
  209                    ($item[
"user_id"] == 
$ilUser->getId() ||
 
  210                    $rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
 
  212                    $valid[] = $item[
"user_id"];
 
  215            if (in_array($req_appr_id, 
$valid)) {
 
  223        $this->ctrl->setParameter($this, 
"appr_id", 
$appr_id);
 
  239        if ($this->object->getAnonymize() == 1 &&
 
  244        include_once 
"Modules/Survey/classes/class.ilObjSurveyAccess.php";
 
  246            if ($this->object->getAnonymize() == 1) {
 
  252        if ($this->object->getAnonymize() == 1) {
 
  254            $surveycode = $this->
object->getUserAccessCode(
$ilUser->getId());
 
  255            if ($this->object->isAnonymizedParticipant($surveycode)) {
 
  269            $this->tpl->setVariable(
"TABS", 
"");
 
  270            $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_evaluation_checkaccess.html", 
"Modules/Survey");
 
  271            $this->tpl->setCurrentBlock(
"adm_content");
 
  272            $this->tpl->setVariable(
"AUTHENTICATION_NEEDED", $this->lng->txt(
"svy_check_evaluation_authentication_needed"));
 
  273            $this->tpl->setVariable(
"FORM_ACTION", $this->ctrl->getFormAction($this, 
"checkEvaluationAccess"));
 
  274            $this->tpl->setVariable(
"EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt(
"svy_check_evaluation_access_introduction"));
 
  275            $this->tpl->setVariable(
"VALUE_CHECK", $this->lng->txt(
"ok"));
 
  276            $this->tpl->setVariable(
"VALUE_CANCEL", $this->lng->txt(
"cancel"));
 
  277            $this->tpl->setVariable(
"TEXT_SURVEY_CODE", $this->lng->txt(
"survey_code"));
 
  278            $this->tpl->parseCurrentBlock();
 
  281        $_SESSION[
"anon_evaluation_access"] = 
null;
 
  294        $surveycode = 
$_POST[
"surveycode"];
 
  295        if ($this->object->isAnonymizedParticipant($surveycode)) {
 
  315        $path = 
$tree->getPathFull($this->object->getRefID());
 
  321        $ilCtrl->redirectByClass(
"ilrepositorygui", 
"frameset");
 
  338        $finished_ids = 
null;
 
  339        if ($this->object->get360Mode()) {
 
  342                $this->ctrl->redirect($this, $details ? 
"evaluationdetails" : 
"evaluation");
 
  344            $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
 
  345            if (!
sizeof($finished_ids)) {
 
  346                $finished_ids = array(-1);
 
  351        $title_row = array();
 
  352        $do_title = $do_label = 
true;
 
  353        switch (
$_POST[
'export_label']) {
 
  355                $title_row[] = $this->lng->txt(
"label");
 
  360                $title_row[] = $this->lng->txt(
"title");
 
  365                $title_row[] = $this->lng->txt(
"title");
 
  366                $title_row[] = $this->lng->txt(
"label");
 
  369        $title_row[] = $this->lng->txt(
"question");
 
  370        $title_row[] = $this->lng->txt(
"question_type");
 
  371        $title_row[] = $this->lng->txt(
"users_answered");
 
  372        $title_row[] = $this->lng->txt(
"users_skipped");
 
  373        $title_row[] = $this->lng->txt(
"mode");
 
  374        $title_row[] = $this->lng->txt(
"mode_text");
 
  375        $title_row[] = $this->lng->txt(
"mode_nr_of_selections");
 
  376        $title_row[] = $this->lng->txt(
"median");
 
  377        $title_row[] = $this->lng->txt(
"arithmetic_mean");
 
  380        switch (
$_POST[
"export_format"]) {
 
  382                include_once 
"Services/Excel/classes/class.ilExcel.php";
 
  384                $excel->addSheet($this->lng->txt(
"svy_eval_cumulated"));
 
  385                $excel->setCellArray(array($title_row), 
"A1");
 
  386                $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof($title_row)-1) . 
"1");
 
  390                $csvfile = array($title_row);
 
  397        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  398        foreach ($this->object->getSurveyQuestions() as $qdata) {
 
  400            $q_res =  $q_eval->getResults();
 
  401            $ov_rows = $q_eval->exportResults($q_res, $do_title, $do_label);
 
  403            switch (
$_POST[
"export_format"]) {
 
  405                    $excel->setActiveSheet(0);
 
  406                    foreach ($ov_rows as 
$row) {
 
  407                        foreach (
$row as $col => $value) {
 
  408                            $excel->setCell($ov_row, $col, $value);
 
  415                    foreach ($ov_rows as 
$row) {
 
  422                switch (
$_POST[
"export_format"]) {
 
  432            ? $this->lng->txt(
"svy_eval_cumulated")
 
  433            : $this->lng->txt(
"svy_eval_detail");
 
  435        $surveyname = $this->
object->getTitle() . 
" " . 
$type . 
" " . 
date(
"Y-m-d");
 
  436        $surveyname = preg_replace(
"/\s/", 
"_", trim($surveyname));
 
  440        switch (
$_POST[
"export_format"]) {
 
  442                $excel->sendToClient($surveyname);
 
  448                foreach ($csvfile as $csvrow) {
 
  450                    $csv .= join($csvrow, $separator) . 
"\n";
 
  469        $question_res = $a_results;
 
  471        if (is_array($question_res)) {
 
  472            $question_res = $question_res[0][1];
 
  475        $question = $question_res->getQuestion();
 
  477        $a_excel->
addSheet($question->getTitle());
 
  485            $kv[$this->lng->txt(
"title")] = $question->getTitle();
 
  488            $kv[$this->lng->txt(
"label")] = $question->label;
 
  492        $kv[$this->lng->txt(
"question")] = $question->getQuestiontext();
 
  500        $kv[$this->lng->txt(
"users_answered")] = (int) $question_res->getUsersAnswered();
 
  501        $kv[$this->lng->txt(
"users_skipped")] = (int) $question_res->getUsersSkipped();         
 
  505        foreach ($kv as 
$key => $value) {
 
  507            $a_excel->
setCell($excel_row++, 1, $value);
 
  532            foreach ($a_results as $row_results) {
 
  533                $row_title = $row_results[0];
 
  535                $a_excel->
setCell($excel_row, 0, $this->lng->txt(
"row"));
 
  536                $a_excel->
setCell($excel_row++, 1, $row_title);
 
  543                    is_array($texts[$row_title])
 
  544                        ? array(
""=>$texts[$row_title])
 
  552            $a_excel->
setCell($excel_row++, 0, $this->lng->txt(
"overview"));
 
  556            $cats = $question->getColumns();
 
  557            foreach ($cats->getCategories() as $cat) {
 
  564            foreach ($a_results as $row_results) {
 
  565                $row_title = $row_results[0];
 
  567                $a_excel->
setCell($excel_row, 0, $row_title);
 
  569                $vars = $row_results[1]->getVariables();
 
  571                    foreach ($vars as $var) {
 
  580        $a_excel->
setBold(
"A1:A" . $excel_row);
 
  587        if ($a_include_mode) {
 
  590                $kv[$this->lng->txt(
"mode")] = is_array($a_results->
getModeValue())
 
  602            if ($a_results->
getMean() !== 
null) {
 
  603                $kv[$this->lng->txt(
"arithmetic_mean")] = $a_results->
getMean();
 
  607        foreach ($kv as 
$key => $value) {
 
  609            $a_excel->
setCell($a_excel_row++, 1, $value);
 
  616            $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"categories"));
 
  617            foreach ($a_grid[
"cols"] as $col_idx => $col) {
 
  618                $a_excel->
setCell($a_excel_row, $col_idx+1, $col);
 
  623            foreach ($a_grid[
"rows"] as 
$cols) {
 
  624                foreach (
$cols as $col_idx => $col) {
 
  625                    $a_excel->
setCell($a_excel_row, $col_idx+1, $col);
 
  632        if ($a_text_answers) {
 
  634            $a_excel->
setCell($a_excel_row, 0, $this->lng->txt(
"freetext_answers"));
 
  637            if (!is_array($a_text_answers[
""])) {
 
  639                $a_excel->
setCell($a_excel_row, 1, $this->lng->txt(
"title"));
 
  640                $a_excel->
setCell($a_excel_row++, 2, $this->lng->txt(
"answer"));
 
  645                $a_excel->
setCell($a_excel_row++, 1, $this->lng->txt(
"answer"));
 
  648            foreach ($a_text_answers as $var => $items) {
 
  649                foreach ($items as $item) {
 
  650                    if (!is_array($a_text_answers[
""])) {
 
  651                        $a_excel->
setCell($a_excel_row, 1, $var);
 
  652                        $a_excel->
setCell($a_excel_row++, 2, $item);
 
  654                        $a_excel->
setCell($a_excel_row++, 1, $item);
 
  663        if (strlen(
$_POST[
"export_format"])) {
 
  667            $this->ctrl->redirect($this, 
'evaluation');
 
  673        if (strlen(
$_POST[
"export_format"])) {
 
  677            $this->ctrl->redirect($this, 
'evaluation');
 
  684        $this->ctrl->redirect($this, 
'evaluation');
 
  691        $form_id = 
"svymdfrm";
 
  694        $tpl->addOnLoadCode(
'$("#form_' . $form_id . 
'").submit(function() { $("#' . $a_id . 
'").modal("hide"); });');
 
  696        include_once 
"Services/UIComponent/Modal/classes/class.ilModalGUI.php";
 
  698        $modal->setId($a_id);
 
  699        $modal->setHeading(($this->lng->txt(
"svy_export_format")));
 
  701        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  703        $form->setId($form_id);
 
  704        $form->setFormAction($this->ctrl->getFormAction($this, $a_cmd));
 
  708            self::TYPE_XLS => $this->lng->txt(
'exp_type_excel'),
 
  714        $label->setOptions(array(
 
  715            'label_only' => $this->lng->txt(
'export_label_only'),
 
  716            'title_only' => $this->lng->txt(
'export_title_only'),
 
  717            'title_label'=> $this->lng->txt(
'export_title_label')
 
  719        $form->addItem($label);
 
  721        $form->addCommandButton($a_cmd, $this->lng->txt(
"export"));
 
  722        $form->setPreventDoubleSubmission(
false);
 
  724        $modal->setBody(
$form->getHTML());
 
  726        return $modal->getHTML();
 
  736        $ui_factory = $ui->factory();
 
  737        $ui_renderer = $ui->renderer();
 
  746            switch ($this->object->getEvaluationAccess()) {
 
  761        $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
 
  762        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
  764        $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.il_svy_svy_evaluation.html", 
"Modules/Survey");
 
  766        if ($this->object->get360Mode()) {
 
  772        if (!$this->object->get360Mode() || 
$appr_id) {
 
  774                $captions = 
new ilSelectInputGUI($this->lng->txt(
"svy_eval_captions"), 
"cp");
 
  775                $captions->setOptions(array(
 
  776                    "ap" => $this->lng->txt(
"svy_eval_captions_abs_perc"),
 
  777                    "a" => $this->lng->txt(
"svy_eval_captions_abs"),
 
  778                    "p" => $this->lng->txt(
"svy_eval_captions_perc")
 
  780                $captions->setValue(
$_POST[
"cp"]);
 
  781                $ilToolbar->addInputItem($captions, 
true);
 
  784                $view->setOptions(array(
 
  785                    "tc" => $this->lng->txt(
"svy_eval_view_tables_charts"),
 
  786                    "t" => $this->lng->txt(
"svy_eval_view_tables"),
 
  787                    "c" => $this->lng->txt(
"svy_eval_view_charts")
 
  789                $view->setValue(
$_POST[
"vw"]);
 
  790                $ilToolbar->addInputItem($view, 
true);
 
  792                include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
 
  794                $button->setCaption(
"ok");
 
  795                $button->setCommand(
"evaluationdetails");
 
  796                $button->setOmitPreventDoubleSubmission(
true);
 
  797                $ilToolbar->addButtonInstance($button);
 
  799                $ilToolbar->addSeparator();
 
  802                $dtmpl = 
new ilTemplate(
"tpl.il_svy_svy_results_details.html", 
true, 
true, 
"Modules/Survey");
 
  803                $toc_tpl = 
new ilTemplate(
"tpl.svy_results_table_contents.html", 
true, 
true, 
"Modules/Survey");
 
  804                $this->lng->loadLanguageModule(
"content");
 
  805                $toc_tpl->setVariable(
"TITLE_TOC", $this->lng->txt(
'cont_toc'));
 
  808            $modal_id = 
"svy_ev_exp";
 
  813            include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
  815            $button->setCaption(
"export");
 
  816            $button->setOnClick(
'$(\'#' . $modal_id . 
'\').modal(\
'show\')');
 
  817            $ilToolbar->addButtonInstance($button);
 
  819            $ilToolbar->addSeparator();
 
  821            include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
  823            $button->setCaption(
"print");
 
  824            $button->setOnClick(
"if(il.Accordion) { il.Accordion.preparePrint(); } window.print(); return false;");
 
  825            $button->setOmitPreventDoubleSubmission(
true);
 
  826            $ilToolbar->addButtonInstance($button);
 
  828            $finished_ids = 
null;
 
  830                $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
 
  831                if (!
sizeof($finished_ids)) {
 
  832                    $finished_ids = array(-1);
 
  836            $details_figure = 
$_POST[
"cp"]
 
  839            $details_view = 
$_POST[
"vw"]
 
  844            include_once(
"./Services/UIComponent/NestedList/classes/class.ilNestedList.php");
 
  847            include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  848            foreach ($this->object->getSurveyQuestions() as $qdata) {
 
  850                $q_res =  $q_eval->getResults();
 
  855                    $this->
renderDetails($details_view, $details_figure, $qdata, $q_eval, $q_res);
 
  858                    if ($qdata[
"questionblock_id"] &&
 
  859                        $qdata[
"questionblock_id"] != $this->last_questionblock_id) {
 
  861                        if ($qblock[
"show_blocktitle"]) {
 
  862                            $list->addListNode($qdata[
"questionblock_title"], 
"q" . $qdata[
"questionblock_id"]);
 
  864                        $this->last_questionblock_id = $qdata[
"questionblock_id"];
 
  866                    $anchor_id = 
"svyrdq" . $qdata[
"question_id"];
 
  867                    $list->addListNode(
"<a href='#" . $anchor_id . 
"'>" . $qdata[
"title"] . 
"</a>", $qdata[
"question_id"], $qdata[
"questionblock_id"] ?
 
  868                        "q" . $qdata[
"questionblock_id"] : 0);
 
  873                $list->setListClass(
"il_Explorer");
 
  874                $toc_tpl->setVariable(
"LIST", 
$list->getHTML());
 
  877                $panel_toc = $ui_factory->panel()->standard(
"", $ui_factory->legacy($toc_tpl->get()));
 
  878                $render_toc = $ui_renderer->render($panel_toc);
 
  879                $dtmpl->setVariable(
"PANEL_TOC", $render_toc);
 
  883                $panel_report = $ui_factory->panel()->report($report_title, $this->array_panels);
 
  884                $render_report = $ui_renderer->render($panel_report);
 
  885                $dtmpl->setVariable(
"PANEL_REPORT", $render_report);
 
  888                $this->tpl->setVariable(
'DETAIL', $dtmpl->get());
 
  892        $this->tpl->setVariable(
'MODAL', $modal);
 
  894            include_once 
"./Modules/Survey/classes/tables/class.ilSurveyResultsCumulatedTableGUI.php";
 
  896            $this->tpl->setVariable(
'CUMULATED', $table_gui->getHTML());
 
  906        $path_full = 
$tree->getPathFull($this->object->getRefId());
 
  907        foreach ($path_full as 
$data) {
 
  908            $path .= 
" » ";
 
  913        include_once 
"Services/Link/classes/class.ilLink.php";
 
  917            $this->lng->txt(
"path") => 
$path,
 
  918            $this->lng->txt(
"svy_results") => !$details
 
  919                ? $this->lng->txt(
"svy_eval_cumulated")
 
  920                : $this->lng->txt(
"svy_eval_detail"),
 
  924        $this->tpl->setCurrentBlock(
"print_header_bl");
 
  925        foreach ($props as 
$key => $value) {
 
  926            $this->tpl->setVariable(
"HEADER_PROP_KEY", 
$key);
 
  927            $this->tpl->setVariable(
"HEADER_PROP_VALUE", $value);
 
  928            $this->tpl->parseCurrentBlock();
 
  947        $ui_factory = $this->ui->factory();
 
  948        $a_tpl = 
new ilTemplate(
"tpl.svy_results_details_panel.html", 
true, 
true, 
"Modules/Survey");
 
  950        $question_res = $a_results;
 
  952        if (is_array($question_res)) {
 
  953            $question_res = $question_res[0][1];
 
  956        $question = $question_res->getQuestion();
 
  965        $kv[
"users_answered"] = $question_res->getUsersAnswered();
 
  966        $kv[
"users_skipped"] = $question_res->getUsersSkipped();
 
  969            if ($question_res->getModeValue() !== 
null) {
 
  970                $kv[
"mode"] = wordwrap($question_res->getModeValueAsText(), 50, 
"<br />");
 
  971                $kv[
"mode_nr_of_selections"] = $question_res->getModeNrOfSelections();
 
  973            if ($question_res->getMedian() !== 
null) {
 
  974                $kv[
"median"] = $question_res->getMedianAsText();
 
  976            if ($question_res->getMean() !== 
null) {
 
  977                $kv[
"arithmetic_mean"] = $question_res->getMean();
 
  982        $qst_title = $question->getTitle();
 
  983        $svy_text = nl2br($question->getQuestiontext());
 
  984        $card_table_tpl = 
new ilTemplate(
"tpl.svy_results_details_card.html", 
true, 
true, 
"Modules/Survey");
 
  985        foreach ($kv as 
$key => $value) {
 
  986            $card_table_tpl->setCurrentBlock(
"question_statistics_card");
 
  987            $card_table_tpl->setVariable(
"QUESTION_STATISTIC_KEY", $this->lng->txt(
$key));
 
  988            $card_table_tpl->setVariable(
"QUESTION_STATISTIC_VALUE", $value);
 
  989            $card_table_tpl->parseCurrentBlock();
 
  992        $anchor_id = 
"svyrdq" . $question->getId();
 
  993        $title = 
"<span id='$anchor_id'>$qst_title</span>";
 
  994        $panel_qst_card = $ui_factory->panel()->sub(
$title, $ui_factory->legacy($svy_text))
 
  995            ->withCard($ui_factory->card($svy_type_title)->withSections(array($ui_factory->legacy($card_table_tpl->get()))));
 
  996        array_push($this->array_panels, $panel_qst_card);
 
  999        if ($a_details_parts == 
"t" ||
 
 1000            $a_details_parts == 
"tc") {
 
 1003                ($a_details_figure == 
"ap" || $a_details_figure == 
"a"),
 
 1004                ($a_details_figure == 
"ap" || $a_details_figure == 
"p")
 
 1007                foreach ($grid[
"cols"] as $col) {
 
 1008                    $a_tpl->setCurrentBlock(
"grid_col_header_bl");
 
 1009                    $a_tpl->setVariable(
"COL_HEADER", $col);
 
 1010                    $a_tpl->parseCurrentBlock();
 
 1012                foreach ($grid[
"rows"] as 
$cols) {
 
 1013                    foreach (
$cols as $idx => $col) {
 
 1015                            $a_tpl->touchBlock(
"grid_col_nowrap_bl");
 
 1018                        $a_tpl->setCurrentBlock(
"grid_col_bl");
 
 1019                        $a_tpl->setVariable(
"COL_CAPTION", trim($col));
 
 1020                        $a_tpl->parseCurrentBlock();
 
 1023                    $a_tpl->touchBlock(
"grid_row_bl");
 
 1031            if (array_key_exists(
"", $texts)) {
 
 1032                $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"given_answers"));
 
 1033                foreach ($texts[
""] as $item) {
 
 1034                    $a_tpl->setCurrentBlock(
"text_direct_item_bl");
 
 1035                    $a_tpl->setVariable(
"TEXT_DIRECT", nl2br($item));
 
 1036                    $a_tpl->parseCurrentBlock();
 
 1039                include_once 
"Services/Accordion/classes/class.ilAccordionGUI.php";
 
 1041                $acc->setId(
"svyevaltxt" . $question->getId());
 
 1043                $a_tpl->setVariable(
"TEXT_HEADING", $this->lng->txt(
"freetext_answers"));
 
 1045                foreach ($texts as $var => $items) {
 
 1046                    $list = array(
"<ul class=\"small\">");
 
 1047                    foreach ($items as $item) {
 
 1048                        $list[] = 
"<li>" . nl2br($item) . 
"</li>";
 
 1051                    $acc->addItem($var, implode(
"\n", 
$list));
 
 1054                $a_tpl->setVariable(
"TEXT_ACC", $acc->getHTML());
 
 1059        if ($a_details_parts == 
"c" ||
 
 1060            $a_details_parts == 
"tc") {
 
 1065                    if (is_array(
$chart[1])) {
 
 1066                        foreach (
$chart[1] as $legend_item) {
 
 1067                            $r = hexdec(substr($legend_item[1], 1, 2));
 
 1068                            $g = hexdec(substr($legend_item[1], 3, 2));
 
 1069                            $b = hexdec(substr($legend_item[1], 5, 2));
 
 1071                            $a_tpl->setCurrentBlock(
"legend_bl");
 
 1072                            $a_tpl->setVariable(
"LEGEND_CAPTION", $legend_item[0]);
 
 1073                            $a_tpl->setVariable(
"LEGEND_COLOR", $legend_item[1]);
 
 1074                            $a_tpl->setVariable(
"LEGEND_COLOR_SVG", 
$r . 
"," . $g . 
"," . $b);
 
 1075                            $a_tpl->parseCurrentBlock();
 
 1081                $a_tpl->setVariable(
"CHART", 
$chart);
 
 1084        $panel = $ui_factory->panel()->sub(
"", $ui_factory->legacy($a_tpl->get()));
 
 1085        array_push($this->array_panels, $panel);
 
 1099        if ($this->object->get360Mode()) {
 
 1104                $options[
""] = $this->lng->txt(
"please_select");
 
 1107            foreach ($this->object->getAppraiseesData() as $item) {
 
 1108                if ($item[
"closed"]) {
 
 1109                    $options[$item[
"user_id"]] = $item[
"login"];
 
 1115                if (
$rbacsystem->checkAccess(
"write", $this->object->getRefId()) ||
 
 1117                    include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
 
 1118                    $appr = 
new ilSelectInputGUI($this->lng->txt(
"survey_360_appraisee"), 
"appr_id");
 
 1121                    $ilToolbar->addInputItem($appr, 
true);
 
 1123                    include_once 
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
 
 1125                    $button->setCaption(
"survey_360_select_appraisee");
 
 1126                    $button->setCommand($this->ctrl->getCmd());
 
 1127                    $ilToolbar->addButtonInstance($button);
 
 1130                        $ilToolbar->addSeparator();
 
 1151        $resultarray = array();
 
 1152        foreach (
$row as $rowindex => $entry) {
 
 1153            if (is_array($entry)) {
 
 1154                $entry = implode(
"/", $entry);
 
 1160            if (strpos($entry, 
"\"") !== 
false) {
 
 1161                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 1164            if (strpos($entry, $separator) !== 
false) {
 
 1168            $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
 
 1170                $resultarray[$rowindex] = utf8_decode(
"\"" . $entry . 
"\"");
 
 1172                $resultarray[$rowindex] = utf8_decode($entry);
 
 1175        return $resultarray;
 
 1183        $title_row = $title_row2 = array();
 
 1184        $title_row[] = $this->lng->txt(
"lastname"); 
 
 1185        $title_row[] = $this->lng->txt(
"firstname");
 
 1186        $title_row[] = $this->lng->txt(
"login");
 
 1187        $title_row[] = $this->lng->txt(
'workingtime'); 
 
 1188        $title_row[] = $this->lng->txt(
'survey_results_finished');
 
 1194        if ($this->object->canExportSurveyCode()) {
 
 1195            $title_row[] = $this->lng->txt(
"codes");
 
 1199        $questions = array();
 
 1201        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
 1202        foreach ($this->object->getSurveyQuestions() as $qdata) {
 
 1204            $q_res =  $q_eval->getResults();
 
 1206            $questions[$qdata[
"question_id"]] = array($q_eval, $q_res);
 
 1208            $question = is_array($q_res)
 
 1209                ? $q_res[0][1]->getQuestion()
 
 1210                : $q_res->getQuestion();
 
 1212            $do_title = $do_label = 
true;
 
 1213            switch (
$_POST[
'export_label']) {
 
 1215                    $title_row[] = $question->label;
 
 1221                    $title_row[] = $question->getTitle();
 
 1227                    $title_row[] = $question->getTitle();
 
 1228                    $title_row2[] = $question->label;
 
 1232            $q_eval->getUserSpecificVariableTitles($title_row, $title_row2, $do_title, $do_label);
 
 1238        $rows[] = $title_row;
 
 1239        if (implode(
"", $title_row2)) {
 
 1240            $rows[] = $title_row2;
 
 1246        $finished_ids = 
null;
 
 1247        if ($this->object->get360Mode()) {
 
 1250                $this->ctrl->redirect($this, 
"evaluationuser");
 
 1252            $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
 
 1253            if (!
sizeof($finished_ids)) {
 
 1254                $finished_ids = array(-1);
 
 1258        $participants = $this->
object->getSurveyParticipants($finished_ids);
 
 1260        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
 1261        foreach ($participants as 
$user) {
 
 1262            $user_id = 
$user[
"active_id"];
 
 1271            if ($this->object->canExportSurveyCode()) {
 
 1275            $row[] = $this->
object->getWorkingtimeForParticipant($user_id);
 
 1277            if ((
bool) 
$user[
"finished"]) {
 
 1286            foreach ($questions as $item) {
 
 1290                $q_eval->addUserSpecificResults(
$row, $user_id, $q_res);
 
 1297        $surveyname = $this->
object->getTitle() . 
" " . $this->lng->txt(
"svy_eval_user") . 
" " . 
date(
"Y-m-d");
 
 1298        $surveyname = preg_replace(
"/\s/", 
"_", trim($surveyname));
 
 1301        switch (
$_POST[
"export_format"]) {
 
 1303                include_once 
"Services/Excel/classes/class.ilExcel.php";
 
 1305                $excel->addSheet($this->lng->txt(
"svy_eval_user"));
 
 1308                    foreach (
$row as $col_idx => $col) {
 
 1309                        $excel->setCell($row_idx+1, $col_idx, $col);
 
 1312                        $excel->setBold(
"A1:" . $excel->getColumnCoord(
sizeof(
$row)-1) . 
"1");
 
 1315                $excel->sendToClient($surveyname);
 
 1321                foreach (
$rows as $csvrow) {
 
 1322                    $csvrow = str_replace(
"\n", 
" ", $this->
processCSVRow($csvrow, 
true, $separator));
 
 1323                    $csv .= join($csvrow, $separator) . 
"\n";
 
 1342        if (!$ilAccess->checkAccess(
"write", 
"", $this->object->getRefId())) {
 
 1344            $this->ctrl->redirectByClass(
"ilObjSurveyGUI", 
"infoScreen");
 
 1347        include_once 
"Services/Form/classes/class.ilPropertyFormGUI.php";
 
 1348        $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 
"evaluationuser"));
 
 1350        if ($this->object->get360Mode()) {
 
 1356        if (!$this->object->get360Mode() || 
$appr_id) {
 
 1357            $modal_id = 
"svy_ev_exp";
 
 1360            include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
 1362            $button->setCaption(
"export");
 
 1363            $button->setOnClick(
'$(\'#' . $modal_id . 
'\').modal(\
'show\')');
 
 1364            $ilToolbar->addButtonInstance($button);
 
 1366            $ilToolbar->addSeparator();
 
 1368            include_once 
"Services/UIComponent/Button/classes/class.ilLinkButton.php";
 
 1370            $button->setCaption(
"print");
 
 1371            $button->setOnClick(
"window.print(); return false;");
 
 1372            $button->setOmitPreventDoubleSubmission(
true);
 
 1373            $ilToolbar->addButtonInstance($button);
 
 1375            $finished_ids = 
null;
 
 1377                $finished_ids = $this->
object->getFinishedIdsForAppraiseeId(
$appr_id);
 
 1378                if (!
sizeof($finished_ids)) {
 
 1379                    $finished_ids = array(-1);
 
 1394        include_once 
"./Modules/Survey/classes/tables/class.ilSurveyResultsUserTableGUI.php";
 
 1396        $table_gui->setData(
$data);
 
 1397        $this->tpl->setContent($table_gui->getHTML() . $modal);
 
 1404        $participants = $this->
object->getSurveyParticipants($a_finished_ids);
 
 1406        include_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
 1407        foreach ($this->object->getSurveyQuestions() as $qdata) {
 
 1409            $q_res =  $q_eval->getResults();
 
 1411            $question = is_array($q_res)
 
 1412                ? $q_res[0][1]->getQuestion()
 
 1413                : $q_res->getQuestion();
 
 1415            foreach ($participants as 
$user) {
 
 1416                $user_id = 
$user[
"active_id"];
 
 1418                $parsed_results = $q_eval->parseUserSpecificResults($q_res, $user_id);
 
 1420                if (!array_key_exists($user_id, 
$data)) {
 
 1421                    $wt = $this->
object->getWorkingtimeForParticipant($user_id);
 
 1423                    $finished = 
$user[
"finished"]
 
 1424                        ? 
$user[
"finished_tstamp"]
 
 1427                    $data[$user_id] = array(
 
 1428                            "username" => 
$user[
"sortname"],
 
 1429                            "question" => $question->getTitle(),
 
 1430                            "results" => $parsed_results,
 
 1431                            "workingtime" => $wt,
 
 1432                            "finished" => $finished,
 
 1433                            "subitems" => array()
 
 1436                    $data[$user_id][
"subitems"][] = array(
 
 1438                            "question" => $question->getTitle(),
 
 1439                            "results" => $parsed_results,
 
 1440                            "workingtime" => 
null,
 
 1467        $ilTabs->activateSubtab(
"svy_eval_competences");
 
 1468        $ilTabs->activateTab(
"svy_results");
 
 1470        $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 
"competenceEval"));
 
 1472        if ($this->object->get360Mode()) {
 
 1482        $eval_modes = array();
 
 1485        include_once(
"./Modules/Survey/classes/class.ilSurveySkill.php");
 
 1487        $opts = $sskill->getAllAssignedSkillsAsOptions();
 
 1489        foreach ($opts as 
$id => $o) {
 
 1490            $idarr = explode(
":", 
$id);
 
 1491            $skills[
$id] = array(
"id" => 
$id, 
"title" => $o, 
"profiles" => array(),
 
 1492                "base_skill" => $idarr[0], 
"tref_id" => $idarr[1]);
 
 1498        include_once(
"./Services/Skill/classes/class.ilSkillProfile.php");
 
 1500        foreach ($profiles as $p) {
 
 1502            $prof_levels = $prof->getSkillLevels();
 
 1503            foreach ($prof_levels as $pl) {
 
 1504                if (isset($skills[$pl[
"base_skill_id"] . 
":" . $pl[
"tref_id"]])) {
 
 1505                    $skills[$pl[
"base_skill_id"] . 
":" . $pl[
"tref_id"]][
"profiles"][] =
 
 1508                    $eval_modes[
"gap_" . $p[
"id"]] =
 
 1509                        $lng->txt(
"svy_gap_analysis") . 
": " . $prof->getTitle();
 
 1519        foreach ($skills as $sk) {
 
 1520            if (count($sk[
"profiles"]) == 0) {
 
 1521                $eval_modes[
"skills_of_survey"] = 
$lng->txt(
"svy_all_survey_competences");
 
 1526        $comp_eval_mode = 
$_GET[
"comp_eval_mode"];
 
 1527        if (
$_POST[
"comp_eval_mode"] != 
"") {
 
 1528            $comp_eval_mode = 
$_POST[
"comp_eval_mode"];
 
 1531        if (!isset($eval_modes[$comp_eval_mode])) {
 
 1533            $comp_eval_mode = key($eval_modes);
 
 1534            $ilCtrl->setParameter($this, 
"comp_eval_mode", $comp_eval_mode);
 
 1537        $ilCtrl->saveParameter($this, 
"comp_eval_mode");
 
 1539        include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
 
 1541        $mode_sel->setOptions($eval_modes);
 
 1542        $mode_sel->setValue($comp_eval_mode);
 
 1543        $ilToolbar->addInputItem($mode_sel, 
true);
 
 1545        $ilToolbar->addFormButton(
$lng->txt(
"select"), 
"competenceEval");
 
 1547        if (substr($comp_eval_mode, 0, 4) == 
"gap_") {
 
 1549            $profile_id = (int) substr($comp_eval_mode, 4);
 
 1551            include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
 
 1553            $pskills_gui->setProfileId($profile_id);
 
 1554            $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), 
$lng->txt(
"skmg_eval_type_1"));
 
 1555            if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id, 
$appr_id) > 0) {
 
 1557                $self_levels = array();
 
 1558                foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id, 
true) as $sl) {
 
 1559                    $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
 
 1561                $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
 
 1567            include_once(
"./Services/Skill/classes/class.ilPersonalSkillsGUI.php");
 
 1569            $pskills_gui->setGapAnalysisActualStatusModePerObject($survey->getId(), 
$lng->txt(
"skmg_eval_type_1"));
 
 1570            if ($survey->getFinishedIdForAppraiseeIdAndRaterId(
$appr_id, 
$appr_id) > 0) {
 
 1572                $self_levels = array();
 
 1573                foreach ($sskill->determineSkillLevelsForAppraisee(
$appr_id, 
true) as $sl) {
 
 1574                    $self_levels[$sl[
"base_skill_id"]][$sl[
"tref_id"]] = $sl[
"new_level_id"];
 
 1576                $pskills_gui->setGapAnalysisSelfEvalLevels($self_levels);
 
 1579            foreach ($skills as $skill) {
 
 1581                    "base_skill_id" => (
int) $skill[
"base_skill"],
 
 1582                    "tref_id" => (
int) $skill[
"tref_id"]
 
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
Survey question evaluation.
getChart($a_results)
Get chart.
getExportGrid($a_results)
Get grid data.
getGrid($a_results, $a_abs=true, $a_perc=true)
Get grid data.
getTextAnswers($a_results)
Get text answers.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static _instanciateQuestionEvaluation($question_id, array $a_finished_ids=null)
Creates an instance of a question evaluation with a given question id.
Accordion user interface class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
@classDescription Date and time handling
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
getCoordByColumnAndRow($pColumn=0, $pRow=1)
Get cell coordinate (e.g.
setColors($a_coords, $a_background, $a_font=null)
Set cell(s) colors.
setBold($a_coords)
Set cell(s) to bold.
addSheet($a_name, $a_activate=true)
Add sheet.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static getLogger($a_component_id)
Get component logger.
static getInstance()
Get instance.
static _hasEvaluationAccess($a_obj_id, $user_id)
const EVALUATION_ACCESS_PARTICIPANTS
const EVALUATION_ACCESS_ALL
static _getQuestionblock($questionblock_id)
Returns the database row for a given question block.
const EVALUATION_ACCESS_OFF
static _lookupObjId($a_id)
Personal skills GUI class.
Skill management settings.
static getProfilesOfUser($a_user_id)
Get profiles of a user.
Survey evaluation graphical output.
exportCumulatedResults($details=0)
exportResultsDetailsExcel(ilExcel $a_excel, SurveyQuestionEvaluation $a_eval, $a_results, $a_do_title, $a_do_label)
Export details (excel only)
setEvalSubtabs()
Set the tabs for the evaluation output.
__construct($a_object)
ilSurveyEvaluationGUI constructor
cancelEvaluationAccess()
Cancels the input of the survey access code for evaluation access.
addApprSelectionToToolbar()
Add appraisee selection to toolbar.
checkAnonymizedEvaluationAccess()
Show the detailed evaluation.
renderDetails($a_details_parts, $a_details_figure, array $a_qdata, SurveyQuestionEvaluation $a_eval, $a_results)
Render details.
buildExportModal($a_id, $a_cmd)
setAppraiseeId($a_val)
Set appraisee id.
processCSVRow($row, $quoteAll=false, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
evaluationdetails()
Show the detailed evaluation.
determineAppraiseeId()
Determine appraisee id.
parseResultsToExcel(ilExcel $a_excel, ilSurveyEvaluationResults $a_results, &$a_excel_row, array $a_grid=null, array $a_text_answers=null, $a_include_mode=true)
checkEvaluationAccess()
Checks the evaluation access after entering the survey access code.
getAppraiseeId()
Get appraisee id.
competenceEval()
Competence Evaluation.
parseUserSpecificResults(array $a_finished_ids=null)
evaluationuser()
Print the survey evaluation for a selected user.
executeCommand()
execute command
Survey evaluation answers.
Skill/Competence handling in surveys.
special template class to simplify handling of ITX/PEAR
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
if(isset($_POST['submit'])) $form
if(isset($_REQUEST['delete'])) $list