/**
  * Get singelton instance
  * @return object $ilRPCServerSettings
  */
 public static function getInstance()
 {
     if (self::$instance) {
         return self::$instance;
     }
     return self::$instance = new ilRPCServerSettings();
 }
Exemplo n.º 2
0
 function ilRPCServerAdapter()
 {
     global $ilLog, $ilDB, $ilErr;
     $this->log =& $ilLog;
     $this->db =& $ilDB;
     $this->err =& $ilErr;
     $this->__checkPear();
     $this->settings_obj = ilRPCServerSettings::getInstance();
 }
 /**
  * Creates a print view of the survey questions
  *
  * @access public
  */
 function printViewObject()
 {
     $this->questionsSubtabs("print");
     $template = new ilTemplate("tpl.il_svy_svy_printview.html", TRUE, TRUE, "Modules/Survey");
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         $this->ctrl->setParameter($this, "pdf", "1");
         $template->setCurrentBlock("pdf_export");
         $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "printView"));
         $this->ctrl->setParameter($this, "pdf", "");
         $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
         $template->setVariable("PDF_IMG_ALT", $this->lng->txt("pdf_export"));
         $template->setVariable("PDF_IMG_URL", ilUtil::getHtmlPath(ilUtil::getImagePath("application-pdf.png")));
         $template->parseCurrentBlock();
     }
     $template->setVariable("PRINT_TEXT", $this->lng->txt("print"));
     $template->setVariable("PRINT_URL", "javascript:window.print();");
     $pages =& $this->object->getSurveyPages();
     foreach ($pages as $page) {
         if (count($page) > 0) {
             foreach ($page as $question) {
                 $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
                 if (is_object($questionGUI)) {
                     if (strlen($question["heading"])) {
                         $template->setCurrentBlock("textblock");
                         $template->setVariable("TEXTBLOCK", $question["heading"]);
                         $template->parseCurrentBlock();
                     }
                     $template->setCurrentBlock("question");
                     $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
                     $template->parseCurrentBlock();
                 }
             }
             if (count($page) > 1) {
                 $template->setCurrentBlock("page");
                 $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("page");
                 $template->parseCurrentBlock();
             }
         }
     }
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) {
         $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", TRUE, TRUE, "Modules/Test");
         $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
         $printbody->setVariable("ADM_CONTENT", $template->get());
         $printoutput = $printbody->get();
         $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
         $fo = $this->object->processPrintoutput2FO($printoutput);
         // #11436
         if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
             ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
             $this->ctrl->redirect($this, "printView");
         }
     } else {
         $this->tpl->setVariable("ADM_CONTENT", $template->get());
     }
 }
 /**
  * Save settings
  * @access	public
  */
 function saveSettingsObject()
 {
     include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     global $rbacsystem;
     if (!$rbacsystem->checkAccess('write', $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->object->initSettingsObject();
     $this->object->settings_obj->setMaxHits((int) $_POST['max_hits']);
     $this->object->settings_obj->enableIndex($_POST['search_index']);
     $this->object->settings_obj->enableLucene($_POST['search_lucene']);
     $this->object->settings_obj->setHideAdvancedSearch($_POST['hide_adv_search']);
     $this->object->settings_obj->setAutoCompleteLength($_POST['auto_complete_length']);
     $this->object->settings_obj->setDefaultOperator((int) $_POST['operator']);
     $this->object->settings_obj->enableLuceneItemFilter((int) $_POST['if']);
     $this->object->settings_obj->setLuceneItemFilter((array) $_POST['filter']);
     $rpc_settings = ilRPCServerSettings::getInstance();
     if ($this->object->settings_obj->enabledLucene() and !$rpc_settings->pingServer()) {
         ilUtil::sendInfo($this->lng->txt('search_no_connection_lucene'), true);
         $this->ctrl->redirect($this, 'settings');
         return false;
     }
     $this->object->settings_obj->update();
     ilUtil::sendInfo($this->lng->txt('settings_saved'), true);
     $this->ctrl->redirect($this, 'settings');
     return true;
 }
Exemplo n.º 5
0
 public static function isActive()
 {
     if (self::$is_active === null) {
         // basic admin setting active?
         $certificate_active = new ilSetting("certificate");
         $certificate_active = (bool) $certificate_active->get("active");
         // java/rtpc-server active?
         if ($certificate_active) {
             include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
             $certificate_active = ilRPCServerSettings::getInstance()->isEnabled();
         }
         self::$is_active = (bool) $certificate_active;
     }
     return self::$is_active;
 }
Exemplo n.º 6
0
 /**
  * Creates a print view of the survey questions
  *
  * @access public
  */
 function printViewObject()
 {
     global $ilToolbar;
     $this->questionsSubtabs("print");
     include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
     $button = ilLinkButton::getInstance();
     $button->setCaption("print");
     $button->setOnClick("window.print(); return false;");
     $button->setOmitPreventDoubleSubmission(true);
     $ilToolbar->addButtonInstance($button);
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         $this->ctrl->setParameter($this, "pdf", "1");
         $pdf_url = $this->ctrl->getLinkTarget($this, "printView");
         $this->ctrl->setParameter($this, "pdf", "");
         $button = ilLinkButton::getInstance();
         $button->setCaption("pdf_export");
         $button->setUrl($pdf_url);
         $button->setOmitPreventDoubleSubmission(true);
         $ilToolbar->addButtonInstance($button);
     }
     $template = new ilTemplate("tpl.il_svy_svy_printview.html", TRUE, TRUE, "Modules/Survey");
     $pages =& $this->object->getSurveyPages();
     foreach ($pages as $page) {
         if (count($page) > 0) {
             foreach ($page as $question) {
                 $questionGUI = $this->object->getQuestionGUI($question["type_tag"], $question["question_id"]);
                 if (is_object($questionGUI)) {
                     if (strlen($question["heading"])) {
                         $template->setCurrentBlock("textblock");
                         $template->setVariable("TEXTBLOCK", $question["heading"]);
                         $template->parseCurrentBlock();
                     }
                     $template->setCurrentBlock("question");
                     $template->setVariable("QUESTION_DATA", $questionGUI->getPrintView($this->object->getShowQuestionTitles(), $question["questionblock_show_questiontext"], $this->object->getSurveyId()));
                     $template->parseCurrentBlock();
                 }
             }
             if (count($page) > 1 && $page[0]["questionblock_show_blocktitle"]) {
                 $template->setCurrentBlock("page");
                 $template->setVariable("BLOCKTITLE", $page[0]["questionblock_title"]);
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("page");
                 $template->parseCurrentBlock();
             }
         }
     }
     $this->tpl->addCss("./Modules/Survey/templates/default/survey_print.css", "print");
     if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) {
         $printbody = new ilTemplate("tpl.il_as_tst_print_body.html", TRUE, TRUE, "Modules/Test");
         $printbody->setVariable("TITLE", sprintf($this->lng->txt("tst_result_user_name"), $uname));
         $printbody->setVariable("ADM_CONTENT", $template->get());
         $printoutput = $printbody->get();
         $printoutput = preg_replace("/href=\".*?\"/", "", $printoutput);
         $fo = $this->object->processPrintoutput2FO($printoutput);
         // #11436
         if (!$fo || !$this->object->deliverPDFfromFO($fo)) {
             ilUtil::sendFailure($this->lng->txt("msg_failed"), true);
             $this->ctrl->redirect($this, "printView");
         }
     } else {
         $this->tpl->setVariable("ADM_CONTENT", $template->get());
     }
 }
 /**
  * Returns true if PDF processing is enabled, false otherwise
  *
  * @access public
  */
 public function hasPDFProcessing()
 {
     global $ilias;
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 function saveSettingsObject()
 {
     global $rbacsystem, $ilCtrl;
     $settings = $this->ilias->getAllSettings();
     if (!$rbacsystem->checkAccess("write", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     //init checking var
     $form_valid = true;
     // moved to privacy/security
     /*if($_POST['https'])
     		{
     			include_once './Services/Http/classes/class.ilHTTPS.php';
     
     			if(!ilHTTPS::_checkHTTPS())
     			{
     				ilUtil::sendInfo($this->lng->txt('https_not_possible'));
     				$form_valid = false;
     			}
     			if(!ilHTTPS::_checkHTTP())
     			{
     				ilUtil::sendInfo($this->lng->txt('http_not_possible'));
     				$form_valid = false;
     			}
     		}*/
     // check required user information
     if (empty($_POST["admin_firstname"]) or empty($_POST["admin_lastname"]) or empty($_POST["admin_street"]) or empty($_POST["admin_zipcode"]) or empty($_POST["admin_country"]) or empty($_POST["admin_city"]) or empty($_POST["admin_phone"]) or empty($_POST["admin_email"])) {
         // feedback
         ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
         $form_valid = false;
     }
     // check email adresses
     // feedback_recipient
     if (!ilUtil::is_email($_POST["feedback_recipient"]) and !empty($_POST["feedback_recipient"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("feedback_recipient") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // error_recipient
     if (!ilUtil::is_email($_POST["error_recipient"]) and !empty($_POST["error_recipient"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("error_recipient") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // admin email
     if (!ilUtil::is_email($_POST["admin_email"]) and $form_valid) {
         ilUtil::sendFailure($this->lng->txt("input_error") . ": '" . $this->lng->txt("email") . "'<br/>" . $this->lng->txt("email_not_valid"));
         $form_valid = false;
     }
     // prepare output
     foreach ($_POST as $key => $val) {
         if ($key != "cmd") {
             $_POST[$key] = ilUtil::prepareFormOutput($val, true);
         }
     }
     if (!$form_valid) {
         ////////////////////////////////////////////////////////////
         // load user modified settings again
         // basic data
         $settings["feedback_recipient"] = $_POST["feedback_recipient"];
         $settings["error_recipient"] = $_POST["error_recipient"];
         // modules
         $settings["pub_section"] = $_POST["pub_section"];
         $settings["open_google"] = $_POST["open_google"];
         $settings["default_repository_view"] = $_POST["default_rep_view"];
         $settings["password_assistance"] = $_POST["password_assistance"];
         $settings['short_inst_title'] = $_POST['short_inst_title'];
         $settings["passwd_auto_generate"] = $_POST["password_auto_generate"];
         //$settings["js_edit"] = $_POST["js_edit"];
         $settings["enable_trash"] = $_POST["enable_trash"];
         //$settings["https"] = $_POST["https"];
         //session_reminder
         $settings['session_reminder_enabled'] = (int) $_POST['session_reminder_enabled'];
         // session control
         // contact
         $settings["admin_firstname"] = $_POST["admin_firstname"];
         $settings["admin_lastname"] = $_POST["admin_lastname"];
         $settings["admin_title"] = $_POST["admin_title"];
         $settings["admin_position"] = $_POST["admin_position"];
         $settings["admin_institution"] = $_POST["admin_institution"];
         $settings["admin_street"] = $_POST["admin_street"];
         $settings["admin_zipcode"] = $_POST["admin_zipcode"];
         $settings["admin_city"] = $_POST["admin_city"];
         $settings["admin_country"] = $_POST["admin_country"];
         $settings["admin_phone"] = $_POST["admin_phone"];
         $settings["admin_email"] = $_POST["admin_email"];
         // cron
         $settings["cron_user_check"] = $_POST["cron_user_check"];
         $settings["cron_link_check"] = $_POST["cron_link_check"];
         $settings["cron_web_resource_check"] = $_POST["cron_web_resource_check"];
         $settings["cron_lucene_index"] = $_POST["cron_lucene_index"];
         $settings["forum_notification"] = $_POST["forum_notification"];
         $settings["mail_notification"] = $_POST["mail_notification"];
         $settings["mail_notification_message"] = $_POST["mail_notification_message"];
         // forums
         $settings['frm_store_new'] = $_POST['frm_store_new'];
         // soap
         $settings["soap_user_administration"] = $_POST["soap_user_administration"];
         // data privacy
         /*	$settings["enable_fora_statistics"] = $_POST["enable_fora_statistics"]; */
         $settings["suffix_repl_additional"] = $_POST["suffix_repl_additional"];
         // dynamic links
         $settings["links_dynamic"] = $_POST["links_dynamic"];
     } else {
         ////////////////////////////////////////////////////////////
         // write new settings
         // basic data
         $this->ilias->setSetting("feedback_recipient", $_POST["feedback_recipient"]);
         $this->ilias->setSetting("error_recipient", $_POST["error_recipient"]);
         //$this->ilias->ini->setVariable("language","default",$_POST["default_language"]);
         //set default skin and style
         /*
         			if ($_POST["default_skin_style"] != "")
         			{
         				$sknst = explode(":", $_POST["default_skin_style"]);
         
         				if ($this->ilias->ini->readVariable("layout","style") != $sknst[1] ||
         					$this->ilias->ini->readVariable("layout","skin") != $sknst[0])
         				{
         					$this->ilias->ini->setVariable("layout","skin", $sknst[0]);
         					$this->ilias->ini->setVariable("layout","style",$sknst[1]);
         				}
         			}*/
         // set default view target
         /*
         			if ($_POST["open_views_inside_frameset"] == "1")
         			{
         				$this->ilias->ini->setVariable("layout","view_target","frame");
         			}
         			else
         			{
         				$this->ilias->ini->setVariable("layout","view_target","window");
         			}*/
         // modules
         $this->ilias->setSetting("pub_section", $_POST["pub_section"]);
         $this->ilias->setSetting('open_google', $_POST['open_google']);
         $this->ilias->setSetting("default_repository_view", $_POST["default_rep_view"]);
         //$this->ilias->setSetting('https',$_POST['https']);
         $this->ilias->setSetting('password_assistance', $_POST['password_assistance']);
         $this->ilias->setSetting('passwd_auto_generate', $_POST['password_auto_generate']);
         $this->ilias->setSetting('short_inst_name', $_POST['short_inst_name']);
         $this->ilias->setSetting('enable_trash', $_POST['enable_trash']);
         //session_reminder
         $this->ilias->setSetting('session_reminder_enabled', (int) $_POST['session_reminder_enabled']);
         // contact
         $this->ilias->setSetting("admin_firstname", $_POST["admin_firstname"]);
         $this->ilias->setSetting("admin_lastname", $_POST["admin_lastname"]);
         $this->ilias->setSetting("admin_title", $_POST["admin_title"]);
         $this->ilias->setSetting("admin_position", $_POST["admin_position"]);
         $this->ilias->setSetting("admin_institution", $_POST["admin_institution"]);
         $this->ilias->setSetting("admin_street", $_POST["admin_street"]);
         $this->ilias->setSetting("admin_zipcode", $_POST["admin_zipcode"]);
         $this->ilias->setSetting("admin_city", $_POST["admin_city"]);
         $this->ilias->setSetting("admin_country", $_POST["admin_country"]);
         $this->ilias->setSetting("admin_phone", $_POST["admin_phone"]);
         $this->ilias->setSetting("admin_email", $_POST["admin_email"]);
         // cron
         $this->ilias->setSetting("cron_user_check", $_POST["cron_user_check"]);
         $this->ilias->setSetting("cron_link_check", $_POST["cron_link_check"]);
         $this->ilias->setSetting("cron_web_resource_check", $_POST["cron_web_resource_check"]);
         $this->ilias->setSetting("cron_lucene_index", $_POST["cron_lucene_index"]);
         $this->ilias->setSetting("forum_notification", $_POST["forum_notification"]);
         if ($_POST["forum_notification"] == 2) {
             $this->ilias->setSetting("cron_forum_notification_last_date", date("Y-m-d H:i:s"));
         }
         $this->ilias->setSetting("mail_notification", $_POST["mail_notification"]);
         $this->ilias->setSetting("mail_notification_message", $_POST["mail_notification_message"]);
         // webservice
         $this->ilias->setSetting("soap_user_administration", $_POST["soap_user_administration"]);
         $this->ilias->setSetting("rpc_server_host", trim($_POST["rpc_server_host"]));
         $this->ilias->setSetting("rpc_server_port", trim($_POST["rpc_server_port"]));
         // data privacy
         //	$this->ilias->setSetting("enable_fora_statistics",$_POST["enable_fora_statistics"]);
         // forums
         $this->ilias->setSetting('frm_store_new', $_POST['frm_store_new']);
         // write ini settings
         $this->ilias->ini->write();
         // links dynamic
         $this->ilias->setSetting('links_dynamic', $_POST['links_dynamic']);
         $this->ilias->setSetting("suffix_repl_additional", ilUtil::stripSlashes($_POST["suffix_repl_additional"]));
         $settings = $this->ilias->getAllSettings();
         // feedback
         $feedback = $this->lng->txt("saved_successfully");
         if (trim($_POST["rpc_server_host"]) != "" || trim($_POST["rpc_server_port"]) != "") {
             include_once 'Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
             $rpc_settings = ilRPCServerSettings::getInstance();
             if (!$rpc_settings->pingServer()) {
                 $feedback .= "<br />\n" . $this->lng->txt('java_server_no_connection');
             }
         }
         ilUtil::sendInfo($feedback);
     }
     $ilCtrl->redirect($this, "view");
     //$this->displayBasicSettings();
 }
 /**
  * Print tab to create a print of all questions with points and solutions
  *
  * Print tab to create a print of all questions with points and solutions
  *
  * @access	public
  */
 function printobject()
 {
     global $ilAccess, $ilias;
     if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
         // allow only write access
         ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirect($this, "infoScreen");
     }
     $this->getQuestionsSubTabs();
     $template = new ilTemplate("tpl.il_as_tst_print_test_confirm.html", TRUE, TRUE, "Modules/Test");
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         $this->ctrl->setParameter($this, "pdf", "1");
         $template->setCurrentBlock("pdf_export");
         $template->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "print"));
         $this->ctrl->setParameter($this, "pdf", "");
         $template->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
         $template->setVariable("PDF_IMG_ALT", $this->lng->txt("pdf_export"));
         $template->setVariable("PDF_IMG_URL", ilUtil::getHtmlPath(ilUtil::getImagePath("application-pdf.png")));
         $template->parseCurrentBlock();
     }
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     global $ilUser;
     $print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
     $max_points = 0;
     $counter = 1;
     foreach ($this->object->questions as $question) {
         $template->setCurrentBlock("question");
         $question_gui = $this->object->createQuestionGUI("", $question);
         $template->setVariable("COUNTER_QUESTION", $counter . ".");
         $template->setVariable("QUESTION_TITLE", ilUtil::prepareFormOutput($question_gui->object->getTitle()));
         if ($question_gui->object->getMaximumPoints() == 1) {
             $template->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("point"));
         } else {
             $template->setVariable("QUESTION_POINTS", $question_gui->object->getMaximumPoints() . " " . $this->lng->txt("points"));
         }
         $result_output = $question_gui->getSolutionOutput("", NULL, FALSE, TRUE, FALSE, $this->object->getShowSolutionFeedback());
         if (strlen($result_output) == 0) {
             $result_output = $question_gui->getPreview(FALSE);
         }
         $template->setVariable("SOLUTION_OUTPUT", $result_output);
         $template->parseCurrentBlock("question");
         $counter++;
         $max_points += $question_gui->object->getMaximumPoints();
     }
     $template->setCurrentBlock("navigation_buttons");
     $template->setVariable("BUTTON_PRINT", $this->lng->txt("print"));
     $template->parseCurrentBlock();
     $template->setVariable("TITLE", ilUtil::prepareFormOutput($this->object->getTitle()));
     $template->setVariable("PRINT_TEST", ilUtil::prepareFormOutput($this->lng->txt("tst_print")));
     $template->setVariable("TXT_PRINT_DATE", ilUtil::prepareFormOutput($this->lng->txt("date")));
     $template->setVariable("VALUE_PRINT_DATE", ilUtil::prepareFormOutput(strftime("%c", $print_date)));
     $template->setVariable("TXT_MAXIMUM_POINTS", ilUtil::prepareFormOutput($this->lng->txt("tst_maximum_points")));
     $template->setVariable("VALUE_MAXIMUM_POINTS", ilUtil::prepareFormOutput($max_points));
     if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) {
         $this->object->deliverPDFfromHTML($template->get(), $this->object->getTitle());
     } else {
         $this->tpl->setVariable("PRINT_CONTENT", $template->get());
     }
 }
 /**
  * Output of the pass overview for a test called by a test participant
  *
  * Output of the pass overview for a test called by a test participant
  *
  * @access public
  */
 function outUserResultsOverview()
 {
     global $ilUser, $ilias, $ilLog;
     if (!$this->object->canShowTestResults($ilUser->getId())) {
         $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
     }
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $templatehead = new ilTemplate("tpl.il_as_tst_results_participants.html", TRUE, TRUE, "Modules/Test");
     $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
     $pass = null;
     $user_id = $ilUser->getId();
     $uname = $this->object->userLookupFullName($user_id, TRUE);
     $active_id = $this->object->getTestSession()->getActiveId();
     $hide_details = !$this->object->getShowPassDetails();
     if ($hide_details) {
         $executable = $this->object->isExecutable($ilUser->getId());
         if (!$executable["executable"]) {
             $hide_details = FALSE;
         }
     }
     $begin = microtime(true);
     if ($this->object->getNrOfTries() == 1 && !$hide_details) {
         $pass = 0;
     } else {
         $template->setCurrentBlock("pass_overview");
         $overview = $this->getPassOverview($active_id, "iltestevaluationgui", "outUserResultsOverview", FALSE, $hide_details);
         $template->setVariable("PASS_OVERVIEW", $overview);
         $template->setVariable("TEXT_RESULTS", $this->lng->txt("tst_results_overview"));
         $template->parseCurrentBlock();
     }
     if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) {
         if (is_null($pass)) {
             $pass = $_GET["pass"];
         }
     }
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     if (ilRPCServerSettings::getInstance()->isEnabled()) {
         $this->ctrl->setParameter($this, "pass", $pass);
         $this->ctrl->setParameter($this, "pdf", "1");
         $templatehead->setCurrentBlock("pdf_export");
         $templatehead->setVariable("PDF_URL", $this->ctrl->getLinkTarget($this, "outUserResultsOverview"));
         $this->ctrl->setParameter($this, "pass", "");
         $this->ctrl->setParameter($this, "pdf", "");
         $templatehead->setVariable("PDF_TEXT", $this->lng->txt("pdf_export"));
         $templatehead->setVariable("PDF_IMG_ALT", $this->lng->txt("pdf_export"));
         $templatehead->setVariable("PDF_IMG_URL", ilUtil::getHtmlPath(ilUtil::getImagePath("application-pdf.png")));
         $templatehead->parseCurrentBlock();
         if ($this->object->canShowCertificate($user_id, $active_id)) {
             $templatehead->setVariable("CERTIFICATE_URL", $this->ctrl->getLinkTarget($this, "outCertificate"));
             $templatehead->setVariable("CERTIFICATE_TEXT", $this->lng->txt("certificate"));
         }
     }
     $templatehead->setVariable("BACK_TEXT", $this->lng->txt("tst_results_back_introduction"));
     $templatehead->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "infoScreen"));
     $templatehead->setVariable("PRINT_TEXT", $this->lng->txt("print"));
     $templatehead->setVariable("PRINT_URL", "javascript:window.print();");
     $statement = $this->getFinalStatement($active_id);
     $user_data = $this->getResultsUserdata($active_id, TRUE);
     // output of the details of a selected pass
     $this->ctrl->saveParameter($this, "pass");
     $this->ctrl->saveParameter($this, "active_id");
     if (!is_null($pass)) {
         $result_array =& $this->object->getTestResult($active_id, $pass);
         $command_solution_details = "";
         if ($this->object->getShowSolutionDetails()) {
             $command_solution_details = "outCorrectSolution";
         }
         $detailsoverview = !$hide_details ? $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestevaluationgui", "outUserResultsOverview", $command_solution_details) : '';
         $user_id = $this->object->_getUserIdFromActiveId($active_id);
         if (!$hide_details && $this->object->canShowSolutionPrintview()) {
             $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass);
         } else {
             if ($this->object->getShowSolutionDetails()) {
                 // if this is not commented out, all questions with checkmarks/crosses will be shown
                 // $list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, true);
             }
         }
         $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
         $template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
         $template->setVariable("PASS_DETAILS", $detailsoverview);
         $signature = $this->getResultsSignature();
         $template->setVariable("SIGNATURE", $signature);
     }
     if ($this->object->getAnonymity()) {
         $template->setVariable("TEXT_HEADING", $this->lng->txt("tst_result"));
     } else {
         $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
         $template->setVariable("USER_DATA", $user_data);
     }
     $template->setVariable("USER_MARK", $statement["mark"]);
     if (strlen($statement["markects"])) {
         $template->setVariable("USER_MARK_ECTS", $statement["markects"]);
     }
     $template->parseCurrentBlock();
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     if ($this->object->getShowSolutionAnswersOnly()) {
         $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
     }
     $templatehead->setVariable("RESULTS_PARTICIPANT", $template->get());
     if (array_key_exists("pdf", $_GET) && $_GET["pdf"] == 1) {
         $this->object->deliverPDFfromHTML($template->get(), sprintf($this->lng->txt("tst_result_user_name"), $uname));
     } else {
         $this->tpl->setVariable("PRINT_CONTENT", $templatehead->get());
     }
 }
Exemplo n.º 11
0
 /**
  * Create an XML_RPC2 client instance
  * 
  * We use Php as backend, since xmlrpc encodes utf8 as html entity 
  * 
  * @param string $a_package	 Package name
  * @return 
  */
 public static function factory($a_package)
 {
     include_once './Services/WebServices/RPC/classes/class.ilRPCServerSettings.php';
     $client = XML_RPC2_Client::create(ilRPCServerSettings::getInstance()->getServerUrl(), array('prefix' => $a_package . '.', 'encoding' => 'utf-8', 'backend' => 'Php', 'debug' => false));
     return $client;
 }