/** * @param ilObjUser $user * * @return ilObjUser */ public function afterLogout(ilObjUser $user) { $this->log->write('afterlogout'); foreach ($this->getPluginObjects() as $pl) { $user = $pl->afterLogout($user); } return $user; }
/** * build xml export file */ function buildExportFileXML() { global $ilBench; $ilBench->start("TestExport", "buildExportFile"); include_once "./Services/Xml/classes/class.ilXmlWriter.php"; $this->xml = new ilXmlWriter(); // set dtd definition $this->xml->xmlSetDtdDef("<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">"); // set generated comment $this->xml->xmlSetGenCmt("Export of ILIAS Test " . $this->test_obj->getId() . " of installation " . $this->inst . "."); // set xml header $this->xml->xmlHeader(); // create directories $this->test_obj->createExportDirectory(); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::makeDir($this->export_dir . "/" . $this->subdir); ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects"); // get Log File $expDir = $this->test_obj->getExportDirectory(); include_once "./Services/Logging/classes/class.ilLog.php"; $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // write qti file $qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->qti_filename, "w"); fwrite($qti_file, $this->test_obj->toXML()); fclose($qti_file); // get xml content $ilBench->start("TestExport", "buildExportFile_getXML"); $this->test_obj->exportPagesXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog); $ilBench->stop("TestExport", "buildExportFile_getXML"); // dump xml document to screen (only for debugging reasons) /* echo "<PRE>"; echo htmlentities($this->xml->xmlDumpMem($format)); echo "</PRE>"; */ // dump xml document to file $ilBench->start("TestExport", "buildExportFile_dumpToFile"); $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false); $ilBench->stop("TestExport", "buildExportFile_dumpToFile"); if (@file_exists("./Modules/Test/classes/class.ilTestResultsToXML.php")) { // dump results xml document to file include_once "./Modules/Test/classes/class.ilTestResultsToXML.php"; $resultwriter = new ilTestResultsToXML($this->test_obj->getTestId(), $this->test_obj->getAnonymity()); $ilBench->start("TestExport", "buildExportFile_results"); $resultwriter->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->resultsfile, false); $ilBench->stop("TestExport", "buildExportFile_results"); } // add media objects which were added with tiny mce $ilBench->start("QuestionpoolExport", "buildExportFile_saveAdditionalMobs"); $this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir); $ilBench->stop("QuestionpoolExport", "buildExportFile_saveAdditionalMobs"); // zip the file $ilBench->start("TestExport", "buildExportFile_zipFile"); ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); $ilBench->stop("TestExport", "buildExportFile_zipFile"); // destroy writer object $this->xml->_XmlWriter; $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("TestExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * build xml export file */ function buildExportFileXML() { global $ilBench; $ilBench->start("SurveyExport", "buildExportFile"); // create directories $this->survey_obj->createExportDirectory(); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::makeDir($this->export_dir . "/" . $this->subdir); ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects"); // get Log File $expDir = $this->survey_obj->getExportDirectory(); include_once "./Services/Logging/classes/class.ilLog.php"; $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // write xml file $xmlFile = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w"); fwrite($xmlFile, $this->survey_obj->toXML()); fclose($xmlFile); // add media objects which were added with tiny mce $this->exportXHTMLMediaObjects($this->export_dir . "/" . $this->subdir); // zip the file $ilBench->start("SurveyExport", "buildExportFileXML_zipFile"); ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); $ilBench->stop("SurveyExport", "buildExportFileXML_zipFile"); if (@file_exists($this->export_dir . "/" . $this->subdir . ".zip")) { // remove export directory and contents if (@is_dir($this->export_dir . "/" . $this->subdir)) { ilUtil::delDir($this->export_dir . "/" . $this->subdir); } } $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("SurveyExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * save all measurements */ function save() { global $ilDB, $ilUser; if ($this->isDbBenchEnabled() && is_object($ilUser) && $this->db_enabled_user == $ilUser->getLogin()) { if (is_array($this->db_bench) && is_object($ilDB)) { $this->db_bench_stop_rec = true; $ilDB->manipulate("DELETE FROM benchmark"); foreach ($this->db_bench as $b) { $ilDB->insert("benchmark", array("duration" => array("float", $this->microtimeDiff($b["start"], $b["stop"])), "sql_stmt" => array("clob", $b["sql"]))); } } $this->enableDbBench(false); } // log slow requests //define("LOG_SLOW_REQUESTS", (float) "0.1"); if (defined("SLOW_REQUEST_TIME") && SLOW_REQUEST_TIME > 0) { $t1 = explode(" ", $GLOBALS['ilGlobalStartTime']); $t2 = explode(" ", microtime()); $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1]; if ($diff > SLOW_REQUEST_TIME) { global $ilIliasIniFile; $diff = round($diff, 4); include_once "./Services/Logging/classes/class.ilLog.php"; $slow_request_log = new ilLog($ilIliasIniFile->readVariable("log", "slow_request_log_path"), $ilIliasIniFile->readVariable("log", "slow_request_log_file"), CLIENT_ID); $slow_request_log->write("SLOW REQUEST (" . $diff . "), Client:" . CLIENT_ID . ", GET: " . str_replace("\n", " ", print_r($_GET, true)) . ", POST: " . ilUtil::shortenText(str_replace("\n", " ", print_r($_POST, true)), 800, true)); } } }
function buildExportFilePDF() { global $ilBench; /*include_once('./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php'); $pp = ilRPCServerSettings::getInstance(); if(!$pp->isEnabled()||!$pp->pingServer()) { $this->ilias->raiseError("Xml Rpc Server is not running. Check Administration/Webservices/Java-Server settings", $this->ilias->error_obj->MESSAGE); return; }*/ $ilBench->start("ContentObjectExport", "buildExportFile"); require_once "./Services/Xml/classes/class.ilXmlWriter.php"; // create directories $this->createExportDirectory(); ilUtil::makeDir($this->export_dir . "/" . $this->subdir); // get Log File $expDir = $this->export_dir; $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); $ilBench->start("ContentObjectExport", "buildExportFile_getXML"); $fo_string = $this->cont_obj->exportPDF($this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog); $ilBench->stop("ContentObjectExport", "buildExportFile_getXML"); $ilBench->start("ContentObjectExport", "buildExportFile_pdfFile"); fputs(fopen($this->export_dir . "/" . $this->subdir . '/temp.fo', 'w+'), $fo_string); global $ilLog; include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php'; try { $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($fo_string); //ilUtil::deliverData($pdf_base64->scalar,'learning_progress.pdf','application/pdf'); fputs(fopen($this->export_dir . '/' . $this->subdir . '.pdf', 'w+'), $pdf_base64->scalar); } catch (XML_RPC2_FaultException $e) { ilUtil::sendFailure($e->getMessage(), true); return false; } catch (Exception $e) { ilUtil::sendFailure($e->getMessage(), true); return false; } $ilBench->stop("ContentObjectExport", "buildExportFile_pdfFile"); ilUtil::delDir($this->export_dir . "/" . $this->subdir); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("ContentObjectExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".pdf"; }
/** * build xml export file */ function buildExportFileXML($questions = null) { global $ilBench; $ilBench->start("SurveyQuestionpoolExport", "buildExportFile"); // create directories $this->spl_obj->createExportDirectory(); include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::makeDir($this->export_dir . "/" . $this->subdir); // get Log File include_once "./Services/Logging/classes/class.ilLog.php"; $expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // write qti file $qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w"); fwrite($qti_file, $this->spl_obj->toXML($questions)); fclose($qti_file); // destroy writer object $this->xml->_XmlWriter; ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("SurveyQuestionpoolExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * @param $a_msg * @param null $log_level */ function write($a_msg, $log_level = NULL) { parent::write($a_msg, $log_level); // TODO: Change the autogenerated stub }
/** * build export file (complete zip file) */ function buildExportFileXML() { global $ilBench; $ilBench->start("GlossaryExport", "buildExportFile"); require_once "./Services/Xml/classes/class.ilXmlWriter.php"; $this->xml = new ilXmlWriter(); // set dtd definition $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">"); // set generated comment $this->xml->xmlSetGenCmt("Export of ILIAS Glossary " . $this->glo_obj->getId() . " of installation " . $this->inst . "."); // set xml header $this->xml->xmlHeader(); // create directories $this->glo_obj->createExportDirectory(); ilUtil::makeDir($this->export_dir . "/" . $this->subdir); ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects"); // get Log File $expDir = $this->glo_obj->getExportDirectory(); $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // get xml content //echo "ContObjExport:".$this->inst_id.":<br>"; $ilBench->start("GlossaryExport", "buildExportFile_getXML"); $this->glo_obj->exportXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog); $ilBench->stop("GlossaryExport", "buildExportFile_getXML"); // dump xml document to screen (only for debugging reasons) /* echo "<PRE>"; echo htmlentities($this->xml->xmlDumpMem($format)); echo "</PRE>"; */ // dump xml document to file $ilBench->start("GlossaryExport", "buildExportFile_dumpToFile"); $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false); $ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile"); // zip the file $ilBench->start("GlossaryExport", "buildExportFile_zipFile"); ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); $ilBench->stop("GlossaryExport", "buildExportFile_zipFile"); // destroy writer object $this->xml->_XmlWriter; $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("GlossaryExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * build xml export file */ function buildExportFileXML() { global $ilBench; $ilBench->start("ContentObjectExport", "buildExportFile"); require_once "./Services/Xml/classes/class.ilXmlWriter.php"; $this->xml = new ilXmlWriter(); // set dtd definition $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">"); // set generated comment $this->xml->xmlSetGenCmt("Export of ILIAS Content Module " . $this->cont_obj->getId() . " of installation " . $this->inst . "."); // set xml header $this->xml->xmlHeader(); // create directories $this->cont_obj->createExportDirectory(); ilUtil::makeDir($this->export_dir . "/" . $this->subdir); ilUtil::makeDir($this->export_dir . "/" . $this->subdir . "/objects"); // get Log File $expDir = $this->cont_obj->getExportDirectory(); $expLog = new ilLog($expDir, "export.log"); $expLog->delete(); $expLog->setLogFormat(""); $expLog->write(date("[y-m-d H:i:s] ") . "Start Export"); // get xml content //echo "ContObjExport:".$this->inst_id.":<br>"; $ilBench->start("ContentObjectExport", "buildExportFile_getXML"); $this->cont_obj->exportXML($this->xml, $this->inst_id, $this->export_dir . "/" . $this->subdir, $expLog); $ilBench->stop("ContentObjectExport", "buildExportFile_getXML"); // export style if ($this->cont_obj->getStyleSheetId() > 0) { include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $style_obj = new ilObjStyleSheet($this->cont_obj->getStyleSheetId(), false); //$style_obj->exportXML($this->export_dir."/".$this->subdir); $style_obj->setExportSubDir("style"); $style_file = $style_obj->export(); if (is_file($style_file)) { copy($style_file, $this->export_dir . "/" . $this->subdir . "/style.zip"); } } // dump xml document to screen (only for debugging reasons) /* echo "<PRE>"; echo htmlentities($this->xml->xmlDumpMem($format)); echo "</PRE>"; */ // dump xml document to file $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false); // help export (workaround to use ref id here) if (ilObjContentObject::isOnlineHelpModule((int) $_GET["ref_id"])) { include_once "./Services/Export/classes/class.ilExport.php"; $exp = new ilExport(); $exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help", "OnlineHelp", $this->export_dir . "/" . $this->subdir); } // zip the file ilUtil::zip($this->export_dir . "/" . $this->subdir, $this->export_dir . "/" . $this->subdir . ".zip"); // destroy writer object $this->xml->_XmlWriter; $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export"); $ilBench->stop("ContentObjectExport", "buildExportFile"); return $this->export_dir . "/" . $this->subdir . ".zip"; }
/** * Download certificate * * Note: No permission checking, this must be done by the controller calling this method */ public function download() { if ($this->status != self::STATUS_PROCESSED && $this->status != self::STATUS_CALLED_BACK) { return; } $file = $this->getFilePath(); if (!is_file($file)) { $this->log->write("srCertificate::download(): Trying to download certificate but file is missing {$file}"); } ilUtil::deliverFile($file, $this->getFilename(), 'application/pdf'); }