• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Modules/Survey/classes/class.ilSurveyEvaluationGUI.php

Go to the documentation of this file.
00001 <?php
00002  /*
00003    +----------------------------------------------------------------------------+
00004    | ILIAS open source                                                          |
00005    +----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne           |
00007    |                                                                            |
00008    | This program is free software; you can redistribute it and/or              |
00009    | modify it under the terms of the GNU General Public License                |
00010    | as published by the Free Software Foundation; either version 2             |
00011    | of the License, or (at your option) any later version.                     |
00012    |                                                                            |
00013    | This program is distributed in the hope that it will be useful,            |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of             |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              |
00016    | GNU General Public License for more details.                               |
00017    |                                                                            |
00018    | You should have received a copy of the GNU General Public License          |
00019    | along with this program; if not, write to the Free Software                |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
00021    +----------------------------------------------------------------------------+
00022 */
00023 
00024 include_once "./Modules/Survey/classes/inc.SurveyConstants.php";
00025 
00037 class ilSurveyEvaluationGUI
00038 {
00039         var $object;
00040         var $lng;
00041         var $tpl;
00042         var $ctrl;
00043         
00052   function ilSurveyEvaluationGUI($a_object)
00053   {
00054                 global $lng, $tpl, $ilCtrl;
00055 
00056     $this->lng =& $lng;
00057     $this->tpl =& $tpl;
00058                 $this->ctrl =& $ilCtrl;
00059                 $this->object =& $a_object;
00060         }
00061         
00065         function &executeCommand()
00066         {
00067                 $cmd = $this->ctrl->getCmd();
00068                 $next_class = $this->ctrl->getNextClass($this);
00069 
00070                 $cmd = $this->getCommand($cmd);
00071                 switch($next_class)
00072                 {
00073                         default:
00074                                 $ret =& $this->$cmd();
00075                                 break;
00076                 }
00077                 return $ret;
00078         }
00079 
00080         function getCommand($cmd)
00081         {
00082                 return $cmd;
00083         }
00084 
00092         function checkAnonymizedEvaluationAccess()
00093         {
00094                 global $rbacsystem;
00095                 global $ilUser;
00096                 
00097                 if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
00098                 {
00099                         // people with write access always have access to the evaluation
00100                         $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
00101                         return $this->evaluation();
00102                 }
00103                 if ($this->object->getEvaluationAccess() == EVALUATION_ACCESS_ALL)
00104                 {
00105                         // if the evaluation access is open for all users, grant it
00106                         $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
00107                         return $this->evaluation();
00108                 }
00109                 $surveycode = $this->object->getUserAccessCode($ilUser->getId());
00110                 if ($this->object->isAnonymizedParticipant($surveycode))
00111                 {
00112                         $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
00113                         return $this->evaluation();
00114                 }
00115                 $this->tpl->setVariable("TABS", "");
00116                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "Modules/Survey");
00117                 $this->tpl->setCurrentBlock("adm_content");
00118                 $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
00119                 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00120                 $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
00121                 $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
00122                 $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
00123                 $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
00124                 $this->tpl->parseCurrentBlock();
00125         }
00126 
00134         function checkEvaluationAccess()
00135         {
00136                 $surveycode = $_POST["surveycode"];
00137                 if ($this->object->isAnonymizedParticipant($surveycode))
00138                 {
00139                         $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
00140                         $this->evaluation();
00141                 }
00142                 else
00143                 {
00144                         ilUtil::sendInfo($this->lng->txt("svy_check_evaluation_wrong_key", true));
00145                         $this->cancelEvaluationAccess();
00146                 }
00147         }
00148         
00156         function cancelEvaluationAccess()
00157         {
00158                 include_once "./Services/Utilities/classes/class.ilUtil.php";
00159                 global $tree;
00160                 $path = $tree->getPathFull($this->object->getRefID());
00161                 ilUtil::redirect("repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]);
00162         }
00163         
00171         function evaluationdetails()
00172         {
00173                 $this->evaluation(1);
00174         }
00175         
00176         function exportCumulatedResults($details = 0)
00177         {
00178                 $format_bold = "";
00179                 $format_percent = "";
00180                 $format_datetime = "";
00181                 $format_title = "";
00182                 $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
00183 
00184                 switch ($_POST["export_format"])
00185                 {
00186                         case TYPE_XLS:
00187                                 include_once "./classes/class.ilExcelWriterAdapter.php";
00188                                 $excelfile = ilUtil::ilTempnam();
00189                                 $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
00190                                 $workbook = $adapter->getWorkbook();
00191                                 $workbook->setVersion(8); // Use Excel97/2000 Format
00192                                 // Creating a worksheet
00193                                 $format_bold =& $workbook->addFormat();
00194                                 $format_bold->setBold();
00195                                 $format_percent =& $workbook->addFormat();
00196                                 $format_percent->setNumFormat("0.00%");
00197                                 $format_datetime =& $workbook->addFormat();
00198                                 $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
00199                                 $format_title =& $workbook->addFormat();
00200                                 $format_title->setBold();
00201                                 $format_title->setColor('black');
00202                                 $format_title->setPattern(1);
00203                                 $format_title->setFgColor('silver');
00204                                 $format_title->setAlign('center');
00205                                 // Creating a worksheet
00206                                 include_once ("./classes/class.ilExcelUtils.php");
00207                                 $mainworksheet =& $workbook->addWorksheet();
00208                                 $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold);
00209                                 $mainworksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->lng->txt("question"), $_POST["export_format"]), $format_bold);
00210                                 $mainworksheet->writeString(0, 2, ilExcelUtils::_convert_text($this->lng->txt("question_type"), $_POST["export_format"]), $format_bold);
00211                                 $mainworksheet->writeString(0, 3, ilExcelUtils::_convert_text($this->lng->txt("users_answered"), $_POST["export_format"]), $format_bold);
00212                                 $mainworksheet->writeString(0, 4, ilExcelUtils::_convert_text($this->lng->txt("users_skipped"), $_POST["export_format"]), $format_bold);
00213                                 $mainworksheet->writeString(0, 5, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold);
00214                                 $mainworksheet->writeString(0, 6, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold);
00215                                 $mainworksheet->writeString(0, 7, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold);
00216                                 $mainworksheet->writeString(0, 8, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold);
00217                                 $mainworksheet->writeString(0, 9, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean"), $_POST["export_format"]), $format_bold);
00218                                 break;
00219                         case (TYPE_SPSS):
00220                                 $csvfile = array();
00221                                 $csvrow = array();
00222                                 array_push($csvrow, $this->lng->txt("title"));
00223                                 array_push($csvrow, $this->lng->txt("question"));
00224                                 array_push($csvrow, $this->lng->txt("question_type"));
00225                                 array_push($csvrow, $this->lng->txt("users_answered"));
00226                                 array_push($csvrow, $this->lng->txt("users_skipped"));
00227                                 array_push($csvrow, $this->lng->txt("mode"));
00228 
00229                                 //array_push($csvrow, $this->lng->txt("mode_text"));
00230 
00231 
00232                                 array_push($csvrow, $this->lng->txt("mode_nr_of_selections"));
00233                                 array_push($csvrow, $this->lng->txt("median"));
00234                                 array_push($csvrow, $this->lng->txt("arithmetic_mean"));
00235                                 array_push($csvfile, $csvrow);
00236                                 break;
00237                 }
00238                 $questions =& $this->object->getSurveyQuestions();
00239                 $counter++;
00240                 foreach ($questions as $data)
00241                 {
00242                         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
00243                         $question_type = SurveyQuestion::_getQuestionType($data["question_id"]);
00244                         include_once "./Modules/SurveyQuestionPool/classes/class.$question_type.php";
00245                         $question = new $question_type();
00246                         $question->loadFromDb($data["question_id"]);
00247 
00248                         $eval = $this->object->getCumulatedResults($question);
00249                         switch ($_POST["export_format"])
00250                         {
00251                                 case TYPE_XLS:
00252                                         $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter);
00253                                         break;
00254                                 case (TYPE_SPSS):
00255                                         $csvrows =& $question->setExportCumulatedCVS($eval);
00256                                         foreach ($csvrows as $csvrow)
00257                                         {
00258                                                 array_push($csvfile, $csvrow);
00259                                         }
00260                                         break;
00261                         }
00262                         if ($details)
00263                         {
00264                                 switch ($_POST["export_format"])
00265                                 {
00266                                         case TYPE_XLS:
00267                                                 $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval);
00268                                                 break;
00269                                 }
00270                         }
00271                 }
00272 
00273                 switch ($_POST["export_format"])
00274                 {
00275                         case TYPE_XLS:
00276                                 // Let's send the file
00277                                 $workbook->close();
00278                                 ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
00279                                 exit();
00280                                 break;
00281                         case TYPE_SPSS:
00282                                 $csv = "";
00283                                 $separator = ";";
00284                                 foreach ($csvfile as $csvrow)
00285                                 {
00286                                         $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator);
00287                                         $csv .= join($csvrow, $separator) . "\n";
00288                                 }
00289                                 include_once "./Services/Utilities/classes/class.ilUtil.php";
00290                                 ilUtil::deliverData($csv, "$surveyname.csv");
00291                                 exit();
00292                                 break;
00293                 }
00294         }
00295         
00296         function evaluation($details = 0)
00297         {
00298                 global $ilUser;
00299                 global $rbacsystem;
00300                 global $ilias;
00301 
00302                 if (!$rbacsystem->checkAccess("read",$_GET["ref_id"]))
00303                 {
00304                         ilUtil::sendInfo($this->lng->txt("permission_denied"));
00305                         return;
00306                 }
00307                 switch ($this->object->getEvaluationAccess())
00308                 {
00309                         case EVALUATION_ACCESS_OFF:
00310                                 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
00311                                 {
00312                                         ilUtil::sendInfo($this->lng->txt("permission_denied"));
00313                                         return;
00314                                 }
00315                                 break;
00316                         case EVALUATION_ACCESS_ALL:
00317                                 include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
00318                                 if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())))
00319                                 {
00320                                         ilUtil::sendInfo($this->lng->txt("permission_denied"));
00321                                         return;
00322                                 }
00323                                 break;
00324                         case EVALUATION_ACCESS_PARTICIPANTS:
00325                                 if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"]))
00326                                 {
00327                                         $this->checkAnonymizedEvaluationAccess();
00328                                         return;
00329                                 }
00330                                 break;
00331                 }
00332         
00333                 if (strlen($_POST["export_format"]))
00334                 {
00335                         $this->exportCumulatedResults($details);
00336                         return;
00337                 }
00338 
00339                 ilUtil::sendInfo();
00340                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
00341                 $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
00342                 $counter = 0;
00343                 $classes = array("tblrow1", "tblrow2");
00344                 $questions =& $this->object->getSurveyQuestions();
00345                 foreach ($questions as $data)
00346                 {
00347                         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
00348                         $question_type = SurveyQuestion::_getQuestionType($data["question_id"]);
00349                         $question_type_gui = $question_type . "GUI";
00350                         include_once "./Modules/SurveyQuestionPool/classes/class.$question_type". "GUI.php";
00351                         $question_gui = new $question_type_gui($data["question_id"]);
00352                         $question = $question_gui->object;
00353                         //$question->loadFromDb($data["question_id"]);
00354                         $row = $question_gui->getCumulatedResultRow($counter, $classes[$counter % 2], $this->object->getSurveyId());
00355                         //$eval = $this->object->getCumulatedResults($question);
00356                         $this->tpl->setCurrentBlock("row");
00357                         $this->tpl->setVariable("ROW", $row);
00358                         $this->tpl->parseCurrentBlock();
00359                         if ($details)
00360                         {
00361                                 $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter+1);
00362                                 $this->tpl->setCurrentBlock("detail");
00363                                 $this->tpl->setVariable("DETAIL", $detail);
00364                                 $this->tpl->parseCurrentBlock();
00365                         }
00366                         $counter++;
00367                 }
00368 
00369                 $this->tpl->setCurrentBlock("generic_css");
00370                 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
00371                 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
00372                 $this->tpl->parseCurrentBlock();
00373                 $this->tpl->setCurrentBlock("adm_content");
00374                 $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("title"));
00375                 $this->tpl->setVariable("QUESTION_TEXT", $this->lng->txt("question"));
00376                 $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("question_type"));
00377                 $this->tpl->setVariable("USERS_ANSWERED", $this->lng->txt("users_answered"));
00378                 $this->tpl->setVariable("USERS_SKIPPED", $this->lng->txt("users_skipped"));
00379                 $this->tpl->setVariable("MODE", $this->lng->txt("mode"));
00380                 $this->tpl->setVariable("MODE_NR_OF_SELECTIONS", $this->lng->txt("mode_nr_of_selections"));
00381                 $this->tpl->setVariable("MEDIAN", $this->lng->txt("median"));
00382                 $this->tpl->setVariable("ARITHMETIC_MEAN", $this->lng->txt("arithmetic_mean"));
00383                 global $ilAccess;
00384                 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) 
00385                 {
00386                         $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00387                         $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
00388                         $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
00389                         $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
00390                         $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
00391                         if ($details)
00392                         {
00393                                 $this->tpl->setVariable("CMD_EXPORT", "evaluationdetails");
00394                         }
00395                         else
00396                         {
00397                                 $this->tpl->setVariable("CMD_EXPORT", "evaluation");
00398                         }
00399                 }
00400                 $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
00401                 $this->tpl->setVariable("VALUE_DETAIL", $details);
00402                 $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
00403                 $this->tpl->parseCurrentBlock();
00404         }
00405         
00413         function exportUserSpecificResults($export_format)
00414         {
00415                 $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
00416                 $csvfile = array();
00417                 $csvrow = array();
00418                 $questions = array();
00419                 $eval =& $this->object->getEvaluationForAllUsers();
00420                 $questions =& $this->object->getSurveyQuestions(true);
00421                 array_push($csvrow, $this->lng->txt("username"));
00422                 if ($this->object->canExportSurveyCode())
00423                 {
00424                         array_push($csvrow, $this->lng->txt("codes"));
00425                 }
00426                 if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00427                 {
00428                         array_push($csvrow, $this->lng->txt("gender"));
00429                 }
00430                 $cellcounter = 1;
00431                 foreach ($questions as $question_id => $question_data)
00432                 {
00433                         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
00434                         $question_type = SurveyQuestion::_getQuestionType($question_data["question_id"]);
00435                         include_once "./Modules/SurveyQuestionPool/classes/class.$question_type.php";
00436                         $question = new $question_type();
00437                         $question->loadFromDb($question_data["question_id"]);
00438                         $question->addUserSpecificResultsExportTitles($csvrow);
00439                         $questions[$question_data["question_id"]] = $question;
00440                 }
00441                 array_push($csvfile, $csvrow);
00442 
00443                 foreach ($eval as $user_id => $resultset)
00444                 {
00445                         $csvrow = array();
00446                         array_push($csvrow, $resultset["name"]);
00447                         if ($this->object->canExportSurveyCode())
00448                         {
00449                                 array_push($csvrow, $user_id);
00450                         }
00451                         if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00452                         {
00453                                 array_push($csvrow, $resultset["gender"]);
00454                         }
00455                         foreach ($questions as $question_id => $question)
00456                         {
00457                                 $question->addUserSpecificResultsData($csvrow, $resultset);
00458                         }
00459                         array_push($csvfile, $csvrow);
00460                 }
00461                 switch ($export_format)
00462                 {
00463                         case TYPE_XLS:
00464                                 include_once "./classes/class.ilExcelWriterAdapter.php";
00465                                 $excelfile = ilUtil::ilTempnam();
00466                                 $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
00467                                 $workbook = $adapter->getWorkbook();
00468                                 $workbook->setVersion(8); // Use Excel97/2000 Format
00469                                 // Creating a worksheet
00470                                 $format_bold =& $workbook->addFormat();
00471                                 $format_bold->setBold();
00472                                 $format_percent =& $workbook->addFormat();
00473                                 $format_percent->setNumFormat("0.00%");
00474                                 $format_datetime =& $workbook->addFormat();
00475                                 $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
00476                                 $format_title =& $workbook->addFormat();
00477                                 $format_title->setBold();
00478                                 $format_title->setColor('black');
00479                                 $format_title->setPattern(1);
00480                                 $format_title->setFgColor('silver');
00481                                 $format_title_plain =& $workbook->addFormat();
00482                                 $format_title_plain->setColor('black');
00483                                 $format_title_plain->setPattern(1);
00484                                 $format_title_plain->setFgColor('silver');
00485                                 // Creating a worksheet
00486                                 $mainworksheet =& $workbook->addWorksheet();
00487                                 $row = 0;
00488                                 include_once "./classes/class.ilExcelUtils.php";
00489                                 foreach ($csvfile as $csvrow)
00490                                 {
00491                                         $col = 0;
00492                                         if ($row == 0)
00493                                         {
00494                                                 foreach ($csvrow as $text)
00495                                                 {
00496                                                         $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title);
00497                                                 }
00498                                         }
00499                                         else
00500                                         {
00501                                                 foreach ($csvrow as $text)
00502                                                 {
00503                                                         if (is_numeric($text))
00504                                                         {
00505                                                                 $mainworksheet->writeNumber($row, $col++, $text);
00506                                                         }
00507                                                         else
00508                                                         {
00509                                                                 $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]));
00510                                                         }
00511                                                 }
00512                                         }
00513                                         $row++;
00514                                 }
00515                                 $workbook->close();
00516                                 ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
00517                                 exit();
00518                                 break;
00519                         case TYPE_SPSS:
00520                                 $csv = "";
00521                                 $separator = ";";
00522                                 foreach ($csvfile as $csvrow)
00523                                 {
00524                                         $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
00525                                         $csv .= join($csvrow, $separator) . "\n";
00526                                 }
00527                                 include_once "./Services/Utilities/classes/class.ilUtil.php";
00528                                 ilUtil::deliverData($csv, "$surveyname.csv");
00529                                 exit();
00530                                 break;
00531                 }
00532         }
00533         
00541         function evaluationuser()
00542         {
00543                 global $ilAccess;
00544                 
00545                 if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
00546                 {
00547                         ilUtil::sendInfo($this->lng->txt("no_permission"), TRUE);
00548                         $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
00549                 }
00550                 if (!is_array($_POST))
00551                 {
00552                         $_POST = array();
00553                 }
00554                 if (array_key_exists("export_format", $_POST))
00555                 {
00556                         return $this->exportUserSpecificResults($_POST["export_format"]);
00557                 }
00558 
00559                 $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
00560                 $userResults =& $this->object->getUserSpecificResults();
00561                 ilUtil::sendInfo();
00562                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
00563                 $counter = 0;
00564                 $classes = array("tblrow1top", "tblrow2top");
00565                 $questions =& $this->object->getSurveyQuestions(true);
00566                 $this->tpl->setCurrentBlock("headercell");
00567                 $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("username"));
00568                 $this->tpl->parseCurrentBlock();
00569                 if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00570                 {
00571                         $this->tpl->setCurrentBlock("headercell");
00572                         $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender"));
00573                         $this->tpl->parseCurrentBlock();
00574                 }
00575                 $this->tpl->setCurrentBlock("headercell");
00576                 $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("question"));
00577                 $this->tpl->parseCurrentBlock();
00578 
00579                 $this->tpl->setCurrentBlock("headercell");
00580                 $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("results"));
00581                 $this->tpl->parseCurrentBlock();
00582 
00583                 $cellcounter = 1;
00584                 $participants =& $this->object->getSurveyParticipants();
00585                 foreach ($participants as $data)
00586                 {
00587                         $this->tpl->setCurrentBlock("bodycell");
00588                         $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00589                         $this->tpl->setVariable("TEXT_BODY_CELL", $data["sortname"]);
00590                         $this->tpl->parseCurrentBlock();
00591                         if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00592                         {
00593                                 $this->tpl->setCurrentBlock("bodycell");
00594                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00595                                 $this->tpl->setVariable("TEXT_BODY_CELL", $data["gender"]);
00596                                 $this->tpl->parseCurrentBlock();
00597                         }
00598                         $intro = TRUE;
00599                         $questioncounter = 1;
00600                         foreach ($questions as $question_id => $question_data)
00601                         {
00602                                 if ($intro)
00603                                 {
00604                                         $intro = FALSE;
00605                                 }
00606                                 else
00607                                 {
00608                                         if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00609                                         {
00610                                                 $this->tpl->setCurrentBlock("bodycell");
00611                                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00612                                                 $this->tpl->parseCurrentBlock();
00613                                         }
00614                                         $this->tpl->setCurrentBlock("bodycell");
00615                                         $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00616                                         $this->tpl->parseCurrentBlock();
00617                                 }
00618                                 $this->tpl->setCurrentBlock("bodycell");
00619                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00620                                 $this->tpl->setVariable("TEXT_BODY_CELL", $questioncounter++ . ". " . $question_data["title"]);
00621                                 $this->tpl->parseCurrentBlock();
00622                                 
00623                                 $found = $userResults[$question_id][$data["active_id"]];
00624                                 $text = "";
00625                                 if (is_array($found))
00626                                 {
00627                                         $text = implode("<br />", $found);
00628                                 }
00629                                 else
00630                                 {
00631                                         $text = $found;
00632                                 }
00633                                 if (strlen($text) == 0) $text = $this->lng->txt("skipped");
00634                                 $this->tpl->setCurrentBlock("bodycell");
00635                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00636                                 $this->tpl->setVariable("TEXT_BODY_CELL", $text);
00637                                 $this->tpl->parseCurrentBlock();
00638                                 $this->tpl->setCurrentBlock("row");
00639                                 $this->tpl->parse("row");
00640                         }
00641                         $counter++;
00642                 }
00643                 $this->tpl->setCurrentBlock("generic_css");
00644                 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
00645                 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
00646                 $this->tpl->parseCurrentBlock();
00647                 $this->tpl->setCurrentBlock("adm_content");
00648                 $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
00649                 $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
00650                 $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
00651                 $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
00652                 $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
00653                 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00654                 $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
00655                 $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
00656                 $this->tpl->parseCurrentBlock();
00657         }
00658         
00666         function evaluationuser_old()
00667         {
00668                 if (!is_array($_POST))
00669                 {
00670                         $_POST = array();
00671                 }
00672                 if (array_key_exists("export_format", $_POST))
00673                 {
00674                         return $this->exportUserSpecificResults($_POST["export_format"]);
00675                 }
00676 
00677                 $userResults =& $this->object->getUserSpecificResults();
00678                 ilUtil::sendInfo();
00679                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
00680                 $counter = 0;
00681                 $classes = array("tblrow1top", "tblrow2top");
00682                 $questions =& $this->object->getSurveyQuestions(true);
00683                 $this->tpl->setCurrentBlock("headercell");
00684                 $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("username"));
00685                 $this->tpl->parseCurrentBlock();
00686                 if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00687                 {
00688                         $this->tpl->setCurrentBlock("headercell");
00689                         $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender"));
00690                         $this->tpl->parseCurrentBlock();
00691                 }
00692                 $char = "A";
00693                 $cellcounter = 1;
00694                 $participants =& $this->object->getSurveyParticipants();
00695                 
00696                 foreach ($questions as $question_id => $question_data)
00697                 {
00698                         $this->tpl->setCurrentBlock("headercell");
00699                         $this->tpl->setVariable("TEXT_HEADER_CELL", $char);
00700                         $this->tpl->parseCurrentBlock();
00701                         $this->tpl->setCurrentBlock("legendrow");
00702                         $this->tpl->setVariable("TEXT_KEY", $char++);
00703                         $this->tpl->setVariable("TEXT_VALUE", $question_data["title"]);
00704                         $this->tpl->parseCurrentBlock();
00705                 }
00706 
00707                 foreach ($participants as $data)
00708                 {
00709                         $this->tpl->setCurrentBlock("bodycell");
00710                         $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00711                         $this->tpl->setVariable("TEXT_BODY_CELL", $data["sortname"]);
00712                         $this->tpl->parseCurrentBlock();
00713                         if ($this->object->getAnonymize() == ANONYMIZE_OFF)
00714                         {
00715                                 $this->tpl->setCurrentBlock("bodycell");
00716                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00717                                 $this->tpl->setVariable("TEXT_BODY_CELL", $data["gender"]);
00718                                 $this->tpl->parseCurrentBlock();
00719                         }
00720                         foreach ($questions as $question_id => $question_data)
00721                         {
00722                                 $found = $userResults[$question_id][$data["active_id"]];
00723                                 $text = "";
00724                                 if (is_array($found))
00725                                 {
00726                                         $text = implode("<br />", $found);
00727                                 }
00728                                 else
00729                                 {
00730                                         $text = $found;
00731                                 }
00732                                 if (strlen($text) == 0) $text = $this->lng->txt("skipped");
00733                                 $this->tpl->setCurrentBlock("bodycell");
00734                                 $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
00735                                 $this->tpl->setVariable("TEXT_BODY_CELL", $text);
00736                                 $this->tpl->parseCurrentBlock();
00737                         }
00738                         $this->tpl->setCurrentBlock("row");
00739                         $this->tpl->parse("row");
00740                         $counter++;
00741                 }
00742                 $this->tpl->setCurrentBlock("generic_css");
00743                 $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
00744                 $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
00745                 $this->tpl->parseCurrentBlock();
00746                 $this->tpl->setCurrentBlock("adm_content");
00747                 $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
00748                 $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
00749                 $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
00750                 $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
00751                 $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
00752                 $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
00753                 $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
00754                 $this->tpl->setVariable("TEXT_LEGEND", $this->lng->txt("legend"));
00755                 $this->tpl->setVariable("TEXT_LEGEND_LINK", $this->lng->txt("eval_legend_link"));
00756                 $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
00757                 $this->tpl->parseCurrentBlock();
00758         }
00759 
00767         function outChart()
00768         {
00769                 $survey_id = $_GET["survey"];
00770                 $question_id = $_GET["question"];
00771                 $type = (strlen($_GET["type"])) ? $_GET["type"] : "";
00772                 $question =& $this->object->_instanciateQuestion($question_id);
00773                 $question->outChart($survey_id, $type);
00774         }
00775 }
00776 ?>

Generated on Fri Dec 13 2013 17:56:52 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1