Public Member Functions | Data Fields

ilSurveyEvaluationGUI Class Reference
[Modules/Survey]

Survey evaluation graphical output. More...

Public Member Functions

 ilSurveyEvaluationGUI ($a_object)
 ilSurveyEvaluationGUI constructor
executeCommand ()
 execute command
 getCommand ($cmd)
 checkAnonymizedEvaluationAccess ()
 Show the detailed evaluation.
 checkEvaluationAccess ()
 Checks the evaluation access after entering the survey access code.
 cancelEvaluationAccess ()
 Cancels the input of the survey access code for evaluation access.
 evaluationdetails ()
 Show the detailed evaluation.
 exportCumulatedResults ($details=0)
 evaluation ($details=0)
 exportUserSpecificResults ($export_format)
 Export the user specific results for the survey.
 evaluationuser ()
 Print the survey evaluation for a selected user.
 evaluationuser_old ()
 Print the survey evaluation for a selected user.
 outChart ()
 Creates an image visualising the results of a question.

Data Fields

 $object
 $lng
 $tpl
 $ctrl

Detailed Description

Survey evaluation graphical output.

The ilSurveyEvaluationGUI class creates the evaluation output for the ilObjSurveyGUI class. This saves some heap space because the ilObjSurveyGUI class will be smaller.

Author:
Helmut Schottmüller <helmut.schottmueller@mac.com>
Version:
Id:
class.ilSurveyEvaluationGUI.php 16915 2008-07-10 11:57:30Z hschottm

Definition at line 37 of file class.ilSurveyEvaluationGUI.php.


Member Function Documentation

ilSurveyEvaluationGUI::cancelEvaluationAccess (  ) 

Cancels the input of the survey access code for evaluation access.

Cancels the input of the survey access code for evaluation access

private

Definition at line 156 of file class.ilSurveyEvaluationGUI.php.

References ilUtil::redirect().

Referenced by checkEvaluationAccess().

        {
                include_once "./Services/Utilities/classes/class.ilUtil.php";
                global $tree;
                $path = $tree->getPathFull($this->object->getRefID());
                ilUtil::redirect("repository.php?cmd=frameset&ref_id=" . $path[count($path) - 2]["child"]);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSurveyEvaluationGUI::checkAnonymizedEvaluationAccess (  ) 

Show the detailed evaluation.

Show the detailed evaluation

private

Definition at line 92 of file class.ilSurveyEvaluationGUI.php.

References $_GET, $_SESSION, and evaluation().

Referenced by evaluation().

        {
                global $rbacsystem;
                global $ilUser;
                
                if ($rbacsystem->checkAccess("write", $_GET["ref_id"]))
                {
                        // people with write access always have access to the evaluation
                        $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
                        return $this->evaluation();
                }
                if ($this->object->getEvaluationAccess() == EVALUATION_ACCESS_ALL)
                {
                        // if the evaluation access is open for all users, grant it
                        $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
                        return $this->evaluation();
                }
                $surveycode = $this->object->getUserAccessCode($ilUser->getId());
                if ($this->object->isAnonymizedParticipant($surveycode))
                {
                        $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
                        return $this->evaluation();
                }
                $this->tpl->setVariable("TABS", "");
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_checkaccess.html", "Modules/Survey");
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("AUTHENTICATION_NEEDED", $this->lng->txt("svy_check_evaluation_authentication_needed"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("EVALUATION_CHECKACCESS_INTRODUCTION", $this->lng->txt("svy_check_evaluation_access_introduction"));
                $this->tpl->setVariable("VALUE_CHECK", $this->lng->txt("ok"));
                $this->tpl->setVariable("VALUE_CANCEL", $this->lng->txt("cancel"));
                $this->tpl->setVariable("TEXT_SURVEY_CODE", $this->lng->txt("survey_code"));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSurveyEvaluationGUI::checkEvaluationAccess (  ) 

Checks the evaluation access after entering the survey access code.

Checks the evaluation access after entering the survey access code

private

Definition at line 134 of file class.ilSurveyEvaluationGUI.php.

References $_GET, $_SESSION, cancelEvaluationAccess(), evaluation(), and ilUtil::sendInfo().

        {
                $surveycode = $_POST["surveycode"];
                if ($this->object->isAnonymizedParticipant($surveycode))
                {
                        $_SESSION["anon_evaluation_access"] = $_GET["ref_id"];
                        $this->evaluation();
                }
                else
                {
                        ilUtil::sendInfo($this->lng->txt("svy_check_evaluation_wrong_key", true));
                        $this->cancelEvaluationAccess();
                }
        }

Here is the call graph for this function:

ilSurveyEvaluationGUI::evaluation ( details = 0  ) 

Definition at line 296 of file class.ilSurveyEvaluationGUI.php.

References $_GET, $_SESSION, $data, $ilias, SurveyQuestion::_getQuestionType(), ilObjSurveyAccess::_hasEvaluationAccess(), checkAnonymizedEvaluationAccess(), exportCumulatedResults(), and ilUtil::sendInfo().

Referenced by checkAnonymizedEvaluationAccess(), checkEvaluationAccess(), and evaluationdetails().

        {
                global $ilUser;
                global $rbacsystem;
                global $ilias;

                if (!$rbacsystem->checkAccess("read",$_GET["ref_id"]))
                {
                        ilUtil::sendInfo($this->lng->txt("permission_denied"));
                        return;
                }
                switch ($this->object->getEvaluationAccess())
                {
                        case EVALUATION_ACCESS_OFF:
                                if (!$rbacsystem->checkAccess("write", $_GET["ref_id"]))
                                {
                                        ilUtil::sendInfo($this->lng->txt("permission_denied"));
                                        return;
                                }
                                break;
                        case EVALUATION_ACCESS_ALL:
                                include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
                                if (!($rbacsystem->checkAccess("write",$_GET["ref_id"]) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())))
                                {
                                        ilUtil::sendInfo($this->lng->txt("permission_denied"));
                                        return;
                                }
                                break;
                        case EVALUATION_ACCESS_PARTICIPANTS:
                                if (($this->object->getAnonymize() == 1) && ($_SESSION["anon_evaluation_access"] != $_GET["ref_id"]))
                                {
                                        $this->checkAnonymizedEvaluationAccess();
                                        return;
                                }
                                break;
                }
        
                if (strlen($_POST["export_format"]))
                {
                        $this->exportCumulatedResults($details);
                        return;
                }

                ilUtil::sendInfo();
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation.html", "Modules/Survey");
                $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
                $counter = 0;
                $classes = array("tblrow1", "tblrow2");
                $questions =& $this->object->getSurveyQuestions();
                foreach ($questions as $data)
                {
                        include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                        $question_type = SurveyQuestion::_getQuestionType($data["question_id"]);
                        $question_type_gui = $question_type . "GUI";
                        include_once "./Modules/SurveyQuestionPool/classes/class.$question_type". "GUI.php";
                        $question_gui = new $question_type_gui($data["question_id"]);
                        $question = $question_gui->object;
                        //$question->loadFromDb($data["question_id"]);
                        $row = $question_gui->getCumulatedResultRow($counter, $classes[$counter % 2], $this->object->getSurveyId());
                        //$eval = $this->object->getCumulatedResults($question);
                        $this->tpl->setCurrentBlock("row");
                        $this->tpl->setVariable("ROW", $row);
                        $this->tpl->parseCurrentBlock();
                        if ($details)
                        {
                                $detail = $question_gui->getCumulatedResultsDetails($this->object->getSurveyId(), $counter+1);
                                $this->tpl->setCurrentBlock("detail");
                                $this->tpl->setVariable("DETAIL", $detail);
                                $this->tpl->parseCurrentBlock();
                        }
                        $counter++;
                }

                $this->tpl->setCurrentBlock("generic_css");
                $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
                $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
                $this->tpl->parseCurrentBlock();
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("QUESTION_TITLE", $this->lng->txt("title"));
                $this->tpl->setVariable("QUESTION_TEXT", $this->lng->txt("question"));
                $this->tpl->setVariable("QUESTION_TYPE", $this->lng->txt("question_type"));
                $this->tpl->setVariable("USERS_ANSWERED", $this->lng->txt("users_answered"));
                $this->tpl->setVariable("USERS_SKIPPED", $this->lng->txt("users_skipped"));
                $this->tpl->setVariable("MODE", $this->lng->txt("mode"));
                $this->tpl->setVariable("MODE_NR_OF_SELECTIONS", $this->lng->txt("mode_nr_of_selections"));
                $this->tpl->setVariable("MEDIAN", $this->lng->txt("median"));
                $this->tpl->setVariable("ARITHMETIC_MEAN", $this->lng->txt("arithmetic_mean"));
                global $ilAccess;
                if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) 
                {
                        $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                        $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
                        $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
                        $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
                        $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
                        if ($details)
                        {
                                $this->tpl->setVariable("CMD_EXPORT", "evaluationdetails");
                        }
                        else
                        {
                                $this->tpl->setVariable("CMD_EXPORT", "evaluation");
                        }
                }
                $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
                $this->tpl->setVariable("VALUE_DETAIL", $details);
                $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSurveyEvaluationGUI::evaluationdetails (  ) 

Show the detailed evaluation.

Show the detailed evaluation

private

Definition at line 171 of file class.ilSurveyEvaluationGUI.php.

References evaluation().

        {
                $this->evaluation(1);
        }

Here is the call graph for this function:

ilSurveyEvaluationGUI::evaluationuser (  ) 

Print the survey evaluation for a selected user.

Print the survey evaluation for a selected user

private

Definition at line 541 of file class.ilSurveyEvaluationGUI.php.

References $data, exportUserSpecificResults(), and ilUtil::sendInfo().

        {
                global $ilAccess;
                
                if (!$ilAccess->checkAccess("write", "", $this->object->getRefId()))
                {
                        ilUtil::sendInfo($this->lng->txt("no_permission"), TRUE);
                        $this->ctrl->redirectByClass("ilObjSurveyGUI", "infoScreen");
                }
                if (!is_array($_POST))
                {
                        $_POST = array();
                }
                if (array_key_exists("export_format", $_POST))
                {
                        return $this->exportUserSpecificResults($_POST["export_format"]);
                }

                $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
                $userResults =& $this->object->getUserSpecificResults();
                ilUtil::sendInfo();
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
                $counter = 0;
                $classes = array("tblrow1top", "tblrow2top");
                $questions =& $this->object->getSurveyQuestions(true);
                $this->tpl->setCurrentBlock("headercell");
                $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("username"));
                $this->tpl->parseCurrentBlock();
                if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                {
                        $this->tpl->setCurrentBlock("headercell");
                        $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender"));
                        $this->tpl->parseCurrentBlock();
                }
                $this->tpl->setCurrentBlock("headercell");
                $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("question"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("headercell");
                $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("results"));
                $this->tpl->parseCurrentBlock();

                $cellcounter = 1;
                $participants =& $this->object->getSurveyParticipants();
                foreach ($participants as $data)
                {
                        $this->tpl->setCurrentBlock("bodycell");
                        $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                        $this->tpl->setVariable("TEXT_BODY_CELL", $data["sortname"]);
                        $this->tpl->parseCurrentBlock();
                        if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                        {
                                $this->tpl->setCurrentBlock("bodycell");
                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                $this->tpl->setVariable("TEXT_BODY_CELL", $data["gender"]);
                                $this->tpl->parseCurrentBlock();
                        }
                        $intro = TRUE;
                        $questioncounter = 1;
                        foreach ($questions as $question_id => $question_data)
                        {
                                if ($intro)
                                {
                                        $intro = FALSE;
                                }
                                else
                                {
                                        if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                                        {
                                                $this->tpl->setCurrentBlock("bodycell");
                                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                                $this->tpl->parseCurrentBlock();
                                        }
                                        $this->tpl->setCurrentBlock("bodycell");
                                        $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                        $this->tpl->parseCurrentBlock();
                                }
                                $this->tpl->setCurrentBlock("bodycell");
                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                $this->tpl->setVariable("TEXT_BODY_CELL", $questioncounter++ . ". " . $question_data["title"]);
                                $this->tpl->parseCurrentBlock();
                                
                                $found = $userResults[$question_id][$data["active_id"]];
                                $text = "";
                                if (is_array($found))
                                {
                                        $text = implode("<br />", $found);
                                }
                                else
                                {
                                        $text = $found;
                                }
                                if (strlen($text) == 0) $text = $this->lng->txt("skipped");
                                $this->tpl->setCurrentBlock("bodycell");
                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                $this->tpl->setVariable("TEXT_BODY_CELL", $text);
                                $this->tpl->parseCurrentBlock();
                                $this->tpl->setCurrentBlock("row");
                                $this->tpl->parse("row");
                        }
                        $counter++;
                }
                $this->tpl->setCurrentBlock("generic_css");
                $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
                $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
                $this->tpl->parseCurrentBlock();
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
                $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
                $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
                $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
                $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

ilSurveyEvaluationGUI::evaluationuser_old (  ) 

Print the survey evaluation for a selected user.

Print the survey evaluation for a selected user

private

Definition at line 666 of file class.ilSurveyEvaluationGUI.php.

References $data, exportUserSpecificResults(), and ilUtil::sendInfo().

        {
                if (!is_array($_POST))
                {
                        $_POST = array();
                }
                if (array_key_exists("export_format", $_POST))
                {
                        return $this->exportUserSpecificResults($_POST["export_format"]);
                }

                $userResults =& $this->object->getUserSpecificResults();
                ilUtil::sendInfo();
                $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_svy_svy_evaluation_user.html", "Modules/Survey");
                $counter = 0;
                $classes = array("tblrow1top", "tblrow2top");
                $questions =& $this->object->getSurveyQuestions(true);
                $this->tpl->setCurrentBlock("headercell");
                $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("username"));
                $this->tpl->parseCurrentBlock();
                if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                {
                        $this->tpl->setCurrentBlock("headercell");
                        $this->tpl->setVariable("TEXT_HEADER_CELL", $this->lng->txt("gender"));
                        $this->tpl->parseCurrentBlock();
                }
                $char = "A";
                $cellcounter = 1;
                $participants =& $this->object->getSurveyParticipants();
                
                foreach ($questions as $question_id => $question_data)
                {
                        $this->tpl->setCurrentBlock("headercell");
                        $this->tpl->setVariable("TEXT_HEADER_CELL", $char);
                        $this->tpl->parseCurrentBlock();
                        $this->tpl->setCurrentBlock("legendrow");
                        $this->tpl->setVariable("TEXT_KEY", $char++);
                        $this->tpl->setVariable("TEXT_VALUE", $question_data["title"]);
                        $this->tpl->parseCurrentBlock();
                }

                foreach ($participants as $data)
                {
                        $this->tpl->setCurrentBlock("bodycell");
                        $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                        $this->tpl->setVariable("TEXT_BODY_CELL", $data["sortname"]);
                        $this->tpl->parseCurrentBlock();
                        if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                        {
                                $this->tpl->setCurrentBlock("bodycell");
                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                $this->tpl->setVariable("TEXT_BODY_CELL", $data["gender"]);
                                $this->tpl->parseCurrentBlock();
                        }
                        foreach ($questions as $question_id => $question_data)
                        {
                                $found = $userResults[$question_id][$data["active_id"]];
                                $text = "";
                                if (is_array($found))
                                {
                                        $text = implode("<br />", $found);
                                }
                                else
                                {
                                        $text = $found;
                                }
                                if (strlen($text) == 0) $text = $this->lng->txt("skipped");
                                $this->tpl->setCurrentBlock("bodycell");
                                $this->tpl->setVariable("COLOR_CLASS", $classes[$counter % 2]);
                                $this->tpl->setVariable("TEXT_BODY_CELL", $text);
                                $this->tpl->parseCurrentBlock();
                        }
                        $this->tpl->setCurrentBlock("row");
                        $this->tpl->parse("row");
                        $counter++;
                }
                $this->tpl->setCurrentBlock("generic_css");
                $this->tpl->setVariable("LOCATION_GENERIC_STYLESHEET", "./Modules/Survey/templates/default/evaluation_print.css");
                $this->tpl->setVariable("MEDIA_GENERIC_STYLESHEET", "print");
                $this->tpl->parseCurrentBlock();
                $this->tpl->setCurrentBlock("adm_content");
                $this->tpl->setVariable("EXPORT_DATA", $this->lng->txt("export_data_as"));
                $this->tpl->setVariable("TEXT_EXCEL", $this->lng->txt("exp_type_excel"));
                $this->tpl->setVariable("TEXT_CSV", $this->lng->txt("exp_type_csv"));
                $this->tpl->setVariable("BTN_EXPORT", $this->lng->txt("export"));
                $this->tpl->setVariable("BTN_PRINT", $this->lng->txt("print"));
                $this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("PRINT_ACTION", $this->ctrl->getFormAction($this));
                $this->tpl->setVariable("TEXT_LEGEND", $this->lng->txt("legend"));
                $this->tpl->setVariable("TEXT_LEGEND_LINK", $this->lng->txt("eval_legend_link"));
                $this->tpl->setVariable("CMD_EXPORT", "evaluationuser");
                $this->tpl->parseCurrentBlock();
        }

Here is the call graph for this function:

& ilSurveyEvaluationGUI::executeCommand (  ) 

execute command

Definition at line 65 of file class.ilSurveyEvaluationGUI.php.

References $cmd, $ret, and getCommand().

        {
                $cmd = $this->ctrl->getCmd();
                $next_class = $this->ctrl->getNextClass($this);

                $cmd = $this->getCommand($cmd);
                switch($next_class)
                {
                        default:
                                $ret =& $this->$cmd();
                                break;
                }
                return $ret;
        }

Here is the call graph for this function:

ilSurveyEvaluationGUI::exportCumulatedResults ( details = 0  ) 

Definition at line 176 of file class.ilSurveyEvaluationGUI.php.

References $data, $separator, ilExcelUtils::_convert_text(), SurveyQuestion::_getQuestionType(), ilUtil::deliverData(), ilUtil::deliverFile(), exit, ilUtil::getASCIIFilename(), and ilUtil::ilTempnam().

Referenced by evaluation().

        {
                $format_bold = "";
                $format_percent = "";
                $format_datetime = "";
                $format_title = "";
                $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));

                switch ($_POST["export_format"])
                {
                        case TYPE_XLS:
                                include_once "./classes/class.ilExcelWriterAdapter.php";
                                $excelfile = ilUtil::ilTempnam();
                                $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
                                $workbook = $adapter->getWorkbook();
                                $workbook->setVersion(8); // Use Excel97/2000 Format
                                // Creating a worksheet
                                $format_bold =& $workbook->addFormat();
                                $format_bold->setBold();
                                $format_percent =& $workbook->addFormat();
                                $format_percent->setNumFormat("0.00%");
                                $format_datetime =& $workbook->addFormat();
                                $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
                                $format_title =& $workbook->addFormat();
                                $format_title->setBold();
                                $format_title->setColor('black');
                                $format_title->setPattern(1);
                                $format_title->setFgColor('silver');
                                $format_title->setAlign('center');
                                // Creating a worksheet
                                include_once ("./classes/class.ilExcelUtils.php");
                                $mainworksheet =& $workbook->addWorksheet();
                                $mainworksheet->writeString(0, 0, ilExcelUtils::_convert_text($this->lng->txt("title"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 1, ilExcelUtils::_convert_text($this->lng->txt("question"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 2, ilExcelUtils::_convert_text($this->lng->txt("question_type"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 3, ilExcelUtils::_convert_text($this->lng->txt("users_answered"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 4, ilExcelUtils::_convert_text($this->lng->txt("users_skipped"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 5, ilExcelUtils::_convert_text($this->lng->txt("mode"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 6, ilExcelUtils::_convert_text($this->lng->txt("mode_text"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 7, ilExcelUtils::_convert_text($this->lng->txt("mode_nr_of_selections"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 8, ilExcelUtils::_convert_text($this->lng->txt("median"), $_POST["export_format"]), $format_bold);
                                $mainworksheet->writeString(0, 9, ilExcelUtils::_convert_text($this->lng->txt("arithmetic_mean"), $_POST["export_format"]), $format_bold);
                                break;
                        case (TYPE_SPSS):
                                $csvfile = array();
                                $csvrow = array();
                                array_push($csvrow, $this->lng->txt("title"));
                                array_push($csvrow, $this->lng->txt("question"));
                                array_push($csvrow, $this->lng->txt("question_type"));
                                array_push($csvrow, $this->lng->txt("users_answered"));
                                array_push($csvrow, $this->lng->txt("users_skipped"));
                                array_push($csvrow, $this->lng->txt("mode"));

                                //array_push($csvrow, $this->lng->txt("mode_text"));


                                array_push($csvrow, $this->lng->txt("mode_nr_of_selections"));
                                array_push($csvrow, $this->lng->txt("median"));
                                array_push($csvrow, $this->lng->txt("arithmetic_mean"));
                                array_push($csvfile, $csvrow);
                                break;
                }
                $questions =& $this->object->getSurveyQuestions();
                $counter++;
                foreach ($questions as $data)
                {
                        include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                        $question_type = SurveyQuestion::_getQuestionType($data["question_id"]);
                        include_once "./Modules/SurveyQuestionPool/classes/class.$question_type.php";
                        $question = new $question_type();
                        $question->loadFromDb($data["question_id"]);

                        $eval = $this->object->getCumulatedResults($question);
                        switch ($_POST["export_format"])
                        {
                                case TYPE_XLS:
                                        $counter = $question->setExportCumulatedXLS($mainworksheet, $format_title, $format_bold, $eval, $counter);
                                        break;
                                case (TYPE_SPSS):
                                        $csvrows =& $question->setExportCumulatedCVS($eval);
                                        foreach ($csvrows as $csvrow)
                                        {
                                                array_push($csvfile, $csvrow);
                                        }
                                        break;
                        }
                        if ($details)
                        {
                                switch ($_POST["export_format"])
                                {
                                        case TYPE_XLS:
                                                $question->setExportDetailsXLS($workbook, $format_title, $format_bold, $eval);
                                                break;
                                }
                        }
                }

                switch ($_POST["export_format"])
                {
                        case TYPE_XLS:
                                // Let's send the file
                                $workbook->close();
                                ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
                                exit();
                                break;
                        case TYPE_SPSS:
                                $csv = "";
                                $separator = ";";
                                foreach ($csvfile as $csvrow)
                                {
                                        $csvrow =& $this->object->processCSVRow($csvrow, TRUE, $separator);
                                        $csv .= join($csvrow, $separator) . "\n";
                                }
                                include_once "./Services/Utilities/classes/class.ilUtil.php";
                                ilUtil::deliverData($csv, "$surveyname.csv");
                                exit();
                                break;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSurveyEvaluationGUI::exportUserSpecificResults ( export_format  ) 

Export the user specific results for the survey.

Export the user specific results for the survey

private

Definition at line 413 of file class.ilSurveyEvaluationGUI.php.

References $separator, ilExcelUtils::_convert_text(), SurveyQuestion::_getQuestionType(), ilUtil::deliverData(), ilUtil::deliverFile(), exit, ilUtil::getASCIIFilename(), and ilUtil::ilTempnam().

Referenced by evaluationuser(), and evaluationuser_old().

        {
                $surveyname = ilUtil::getASCIIFilename(preg_replace("/\s/", "_", $this->object->getTitle()));
                $csvfile = array();
                $csvrow = array();
                $questions = array();
                $eval =& $this->object->getEvaluationForAllUsers();
                $questions =& $this->object->getSurveyQuestions(true);
                array_push($csvrow, $this->lng->txt("username"));
                if ($this->object->canExportSurveyCode())
                {
                        array_push($csvrow, $this->lng->txt("codes"));
                }
                if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                {
                        array_push($csvrow, $this->lng->txt("gender"));
                }
                $cellcounter = 1;
                foreach ($questions as $question_id => $question_data)
                {
                        include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
                        $question_type = SurveyQuestion::_getQuestionType($question_data["question_id"]);
                        include_once "./Modules/SurveyQuestionPool/classes/class.$question_type.php";
                        $question = new $question_type();
                        $question->loadFromDb($question_data["question_id"]);
                        $question->addUserSpecificResultsExportTitles($csvrow);
                        $questions[$question_data["question_id"]] = $question;
                }
                array_push($csvfile, $csvrow);

                foreach ($eval as $user_id => $resultset)
                {
                        $csvrow = array();
                        array_push($csvrow, $resultset["name"]);
                        if ($this->object->canExportSurveyCode())
                        {
                                array_push($csvrow, $user_id);
                        }
                        if ($this->object->getAnonymize() == ANONYMIZE_OFF)
                        {
                                array_push($csvrow, $resultset["gender"]);
                        }
                        foreach ($questions as $question_id => $question)
                        {
                                $question->addUserSpecificResultsData($csvrow, $resultset);
                        }
                        array_push($csvfile, $csvrow);
                }
                switch ($export_format)
                {
                        case TYPE_XLS:
                                include_once "./classes/class.ilExcelWriterAdapter.php";
                                $excelfile = ilUtil::ilTempnam();
                                $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
                                $workbook = $adapter->getWorkbook();
                                $workbook->setVersion(8); // Use Excel97/2000 Format
                                // Creating a worksheet
                                $format_bold =& $workbook->addFormat();
                                $format_bold->setBold();
                                $format_percent =& $workbook->addFormat();
                                $format_percent->setNumFormat("0.00%");
                                $format_datetime =& $workbook->addFormat();
                                $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
                                $format_title =& $workbook->addFormat();
                                $format_title->setBold();
                                $format_title->setColor('black');
                                $format_title->setPattern(1);
                                $format_title->setFgColor('silver');
                                $format_title_plain =& $workbook->addFormat();
                                $format_title_plain->setColor('black');
                                $format_title_plain->setPattern(1);
                                $format_title_plain->setFgColor('silver');
                                // Creating a worksheet
                                $mainworksheet =& $workbook->addWorksheet();
                                $row = 0;
                                include_once "./classes/class.ilExcelUtils.php";
                                foreach ($csvfile as $csvrow)
                                {
                                        $col = 0;
                                        if ($row == 0)
                                        {
                                                foreach ($csvrow as $text)
                                                {
                                                        $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title);
                                                }
                                        }
                                        else
                                        {
                                                foreach ($csvrow as $text)
                                                {
                                                        if (is_numeric($text))
                                                        {
                                                                $mainworksheet->writeNumber($row, $col++, $text);
                                                        }
                                                        else
                                                        {
                                                                $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]));
                                                        }
                                                }
                                        }
                                        $row++;
                                }
                                $workbook->close();
                                ilUtil::deliverFile($excelfile, "$surveyname.xls", "application/vnd.ms-excel");
                                exit();
                                break;
                        case TYPE_SPSS:
                                $csv = "";
                                $separator = ";";
                                foreach ($csvfile as $csvrow)
                                {
                                        $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
                                        $csv .= join($csvrow, $separator) . "\n";
                                }
                                include_once "./Services/Utilities/classes/class.ilUtil.php";
                                ilUtil::deliverData($csv, "$surveyname.csv");
                                exit();
                                break;
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSurveyEvaluationGUI::getCommand ( cmd  ) 

Definition at line 80 of file class.ilSurveyEvaluationGUI.php.

References $cmd.

Referenced by executeCommand().

        {
                return $cmd;
        }

Here is the caller graph for this function:

ilSurveyEvaluationGUI::ilSurveyEvaluationGUI ( a_object  ) 

ilSurveyEvaluationGUI constructor

The constructor takes possible arguments an creates an instance of the ilSurveyEvaluationGUI object.

Parameters:
object $a_object Associated ilObjSurvey class public

Definition at line 52 of file class.ilSurveyEvaluationGUI.php.

References $ilCtrl, $lng, and $tpl.

  {
                global $lng, $tpl, $ilCtrl;

    $this->lng =& $lng;
    $this->tpl =& $tpl;
                $this->ctrl =& $ilCtrl;
                $this->object =& $a_object;
        }

ilSurveyEvaluationGUI::outChart (  ) 

Creates an image visualising the results of a question.

Creates an image visualising the results of a question

public

Definition at line 767 of file class.ilSurveyEvaluationGUI.php.

References $_GET.

        {
                $survey_id = $_GET["survey"];
                $question_id = $_GET["question"];
                $type = (strlen($_GET["type"])) ? $_GET["type"] : "";
                $question =& $this->object->_instanciateQuestion($question_id);
                $question->outChart($survey_id, $type);
        }


Field Documentation

ilSurveyEvaluationGUI::$ctrl

Definition at line 42 of file class.ilSurveyEvaluationGUI.php.

ilSurveyEvaluationGUI::$lng

Definition at line 40 of file class.ilSurveyEvaluationGUI.php.

Referenced by ilSurveyEvaluationGUI().

ilSurveyEvaluationGUI::$object

Definition at line 39 of file class.ilSurveyEvaluationGUI.php.

ilSurveyEvaluationGUI::$tpl

Definition at line 41 of file class.ilSurveyEvaluationGUI.php.

Referenced by ilSurveyEvaluationGUI().


The documentation for this class was generated from the following file: