public function getCurrentImageWebPath()
 {
     if ($this->image_current != '' && $this->checkFilesExist(array($this->image_current))) {
         return ilUtil::getWebspaceDir('output') . '/' . self::SHOPPATH . '/' . $this->pobject_id . '/' . $this->image_current;
     }
     return false;
 }
 public function getRelativePathExMailDirectory()
 {
     switch ($this->getStorageType()) {
         case self::STORAGE_DATA:
             $path = ilUtil::getDataDir();
             break;
         case self::STORAGE_WEB:
             $path = ilUtil::getWebspaceDir();
             break;
     }
     $path = ilUtil::removeTrailingPathSeparators($path);
     $path .= '/';
     // Append path prefix
     $path .= $this->getPathPrefix() . '/';
     return str_replace($path, '', $this->getAbsolutePath());
 }
 /**
  * @param $userdata
  * @param $active_id
  */
 public function recalculatePasses($userdata, $active_id)
 {
     require_once './Modules/Test/classes/class.ilTestEvaluationGUI.php';
     // Below!
     require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
     require_once './Modules/Test/classes/class.ilTestArchiver.php';
     $passes = $userdata->getPasses();
     foreach ($passes as $pass => $passdata) {
         if (is_object($passdata)) {
             $this->recalculatePass($passdata, $active_id, $pass);
             if ($this->test->getEnableArchiving()) {
                 // requires out of the loop!
                 $test_evaluation_gui = new ilTestEvaluationGUI($this->test);
                 $overview = $test_evaluation_gui->getPassListOfAnswers($passdata, $active_id, $pass, true, false, false, true);
                 $filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->test->getId() . '-' . $active_id . '-' . $pass . '.pdf';
                 ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
                 $archiver = new ilTestArchiver($this->test->getId());
                 $archiver->handInTestResult($active_id, $pass, $filename);
                 unlink($filename);
             }
         }
     }
 }
 /**
  * Returns the number of bytes used on the harddisk by the learning module
  * with the specified object id.
  * @param int object id of a file object.
  */
 function _lookupDiskUsage($a_id)
 {
     $lm_data_dir = ilUtil::getWebspaceDir('filesystem') . "/lm_data";
     $lm_dir = $lm_data_dir . DIRECTORY_SEPARATOR . "lm_" . $a_id;
     return file_exists($lm_dir) ? ilUtil::dirsize($lm_dir) : 0;
 }
 public function zipLmForOfflineMode()
 {
     $lmDir = ilUtil::getWebspaceDir("filesystem") . "/lm_data/lm_" . $this->getId();
     $zipFile = ilUtil::getDataDir() . "/lm_data/lm_" . $this->getId();
     return ilUtil::zip($lmDir, $zipFile, true);
 }
 /**
  * Deletes smiliey by given id from database.
  *
  * @global ilDBMySQL $ilDB
  * @param integer $a_id
  */
 public static function _deleteSmiley($a_id)
 {
     global $ilDB;
     try {
         $smiley = self::_getSmiley($a_id);
         $path = ilUtil::getWebspaceDir() . '/chatroom/smilies/' . $smiley["smiley_path"];
         if (is_file($path)) {
             unlink($path);
         }
         $ilDB->manipulateF("DELETE FROM chatroom_smilies\n\t\t\t\tWHERE\n\t\t\t\t\tsmiley_id = %s", array('integer'), array($a_id));
     } catch (Exception $e) {
     }
 }
Example #7
0
 /**
  * export media object to html
  */
 function exportHTMLMOB($a_target_dir, &$a_glo_gui, $a_mob_id)
 {
     global $tpl;
     $mob_dir = $a_target_dir . "/mobs";
     $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
     if (@is_dir($source_dir)) {
         ilUtil::makeDir($mob_dir . "/mm_" . $a_mob_id);
         ilUtil::rCopy($source_dir, $mob_dir . "/mm_" . $a_mob_id);
     }
     $tpl = new ilTemplate("tpl.main.html", true, true);
     $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
     $_GET["obj_type"] = "MediaObject";
     $_GET["mob_id"] = $a_mob_id;
     $_GET["cmd"] = "";
     $content =& $a_glo_gui->media();
     $file = $a_target_dir . "/media_" . $a_mob_id . ".html";
     // open file
     if (!($fp = @fopen($file, "w+"))) {
         die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
     }
     chmod($file, 0770);
     fwrite($fp, $content);
     fclose($fp);
     // fullscreen
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob_obj = new ilObjMediaObject($a_mob_id);
     if ($mob_obj->hasFullscreenItem()) {
         $tpl = new ilTemplate("tpl.main.html", true, true);
         $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
         $_GET["mob_id"] = $a_mob_id;
         $_GET["cmd"] = "fullscreen";
         $content = $a_glo_gui->fullscreen();
         $file = $a_target_dir . "/fullscreen_" . $a_mob_id . ".html";
         // open file
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $content);
         fclose($fp);
     }
 }
 function getDataDirectory()
 {
     return ilUtil::getWebspaceDir() . "/mobs/mm_" . $this->getId();
 }
 /**
  * get content style path
  *
  * static (to avoid full reading)
  */
 function getContentStylePath($a_style_id)
 {
     global $ilias;
     $rand = rand(1, 999999);
     // check global fixed content style
     $fixed_style = $ilias->getSetting("fixed_content_style_id");
     if ($fixed_style > 0) {
         $a_style_id = $fixed_style;
     }
     // check global default style
     if ($a_style_id <= 0) {
         $a_style_id = $ilias->getSetting("default_content_style_id");
     }
     if ($a_style_id > 0 && ilObject::_exists($a_style_id)) {
         // check whether file is up to date
         if (!ilObjStyleSheet::_lookupUpToDate($a_style_id)) {
             $style = new ilObjStyleSheet($a_style_id);
             $style->writeCSSFile();
         }
         return ilUtil::getWebspaceDir("output") . "/css/style_" . $a_style_id . ".css?dummy={$rand}";
     } else {
         return "./Services/COPage/css/content.css";
     }
 }
 /**
  * @param $active
  *
  * @return void
  */
 protected function archiveParticipantSubmission($active, $pass)
 {
     global $ilObjDataCache;
     require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
     $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
     $objectivesList = null;
     if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
         $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($this->testSession->getActiveId(), $this->testSession->getPass());
         $testSequence->loadFromDb();
         $testSequence->loadQuestions();
         require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
         $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession);
         $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
         $objectivesList->loadObjectivesTitles();
         $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($this->testSession->getObjectiveOrientedContainerId());
         $testResultHeaderLabelBuilder->setUserId($this->testSession->getUserId());
         $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
         $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
         $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
     }
     $results = $this->object->getTestResult($active, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired());
     require_once 'class.ilTestEvaluationGUI.php';
     $testevaluationgui = new ilTestEvaluationGUI($this->object);
     $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $pass, false, false, false, false, false, $objectivesList, $testResultHeaderLabelBuilder);
     require_once './Modules/Test/classes/class.ilTestArchiver.php';
     global $ilSetting;
     $inst_id = $ilSetting->get('inst_id', null);
     $archiver = new ilTestArchiver($this->object->getId());
     $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->object->getId() . '/exam_pdf';
     if (!is_dir($path)) {
         ilUtil::makeDirParents($path);
     }
     $filename = $path . '/exam_N' . $inst_id . '-' . $this->object->getId() . '-' . $active . '-' . $pass . '.pdf';
     require_once 'class.ilTestPDFGenerator.php';
     ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
     //$template->setVariable("PDF_FILE_LOCATION", $filename);
     // Participant submission
     $archiver->handInParticipantSubmission($active, $pass, $filename, $results_output);
     //$archiver->handInParticipantMisc( $active, $pass, 'signature_gedoens.sig', $filename );
     //$archiver->handInParticipantQuestionMaterial( $active, $pass, 123, 'file_upload.pdf', $filename );
     global $ilias;
     $questions = $this->object->getQuestions();
     foreach ($questions as $question_id) {
         $question_object = $this->object->getQuestionDataset($question_id);
         if ($question_object->type_tag == 'assFileUpload') {
             // Pfad: /data/default/assessment/tst_2/14/21/files/file_14_4_1370417414.png
             // /data/ - klar
             // /assessment/ - Konvention
             // /tst_2/ = /tst_<test_id> (ilObjTest)
             // /14/ = /<active_fi>/
             // /21/ = /<question_id>/ (question_object)
             // /files/ - Konvention
             // file_14_4_1370417414.png = file_<active_fi>_<pass>_<some timestamp>.<ext>
             $candidate_path = $ilias->ini_ilias->readVariable('server', 'absolute_path') . ilTestArchiver::DIR_SEP . $ilias->ini_ilias->readVariable('clients', 'path') . ilTestArchiver::DIR_SEP . $ilias->client_id . ilTestArchiver::DIR_SEP . 'assessment' . ilTestArchiver::DIR_SEP . 'tst_' . $this->object->test_id . ilTestArchiver::DIR_SEP . $active . ilTestArchiver::DIR_SEP . $question_id . ilTestArchiver::DIR_SEP . 'files' . ilTestArchiver::DIR_SEP;
             $handle = opendir($candidate_path);
             while ($handle !== false && ($file = readdir($handle)) !== false) {
                 if ($file != null) {
                     $filename_start = 'file_' . $active . '_' . $pass . '_';
                     if (strpos($file, $filename_start) === 0) {
                         $archiver->handInParticipantQuestionMaterial($active, $pass, $question_id, $file, $file);
                     }
                 }
             }
         }
     }
     $passdata = $this->object->getTestResult($active, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired());
     $overview = $testevaluationgui->getPassListOfAnswers($passdata, $active, $pass, true, false, false, true, false, $objectivesList, $testResultHeaderLabelBuilder);
     $filename = ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->object->getId() . '-' . $active . '-' . $pass . '.pdf';
     ilTestPDFGenerator::generatePDF($overview, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
     $archiver->handInTestResult($active, $pass, $filename);
     unlink($filename);
     return;
 }
Example #11
0
<#4268>
<?php 
$ilDB->insert('il_dcl_datatype_prop', array('id' => array('integer', 13), 'datatype_id' => array('integer', 8), 'title' => array('text', 'display_action_menu'), 'inputformat' => array('integer', 4)));
?>
<#4269>
<?php 
$ilDB->modifyTableColumn('help_map', 'screen_id', array("type" => "text", "length" => 100, "notnull" => false, 'fixed' => false));
?>
<#4270>
	<?php 
$ilDB->modifyTableColumn('help_map', 'screen_sub_id', array("type" => "text", "length" => 100, "notnull" => false, 'fixed' => false));
?>
<#4271>
<?php 
$client_id = basename(CLIENT_DATA_DIR);
$web_path = ilUtil::getWebspaceDir() . $client_id;
$sec_path = $web_path . "/sec";
if (!file_exists($sec_path)) {
    ilUtil::makeDir($sec_path);
}
$mods = array("ilBlog", "ilPoll", "ilPortfolio");
foreach ($mods as $mod) {
    $mod_path = $web_path . "/" . $mod;
    if (file_exists($mod_path)) {
        $mod_sec_path = $sec_path . "/" . $mod;
        rename($mod_path, $mod_sec_path);
    }
}
?>
<#4272>
<?php 
 /**
  * Static render table function
  */
 static function _renderTable($content, $a_mode = "table_edit", $a_submode = "", $a_table_obj = null)
 {
     global $ilUser;
     $content = "<dummy>" . $content . "</dummy>";
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $content, '/_xsl' => $xsl);
     $xh = xslt_create();
     //echo "<b>XML</b>:".htmlentities($content).":<br>";
     //echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
     $med_disabled_path = ilUtil::getImagePath("media_disabled.png");
     $wb_path = ilUtil::getWebspaceDir("output");
     $enlarge_path = ilUtil::getImagePath("enlarge.png");
     $params = array('mode' => $a_mode, 'med_disabled_path' => $med_disabled_path, 'media_mode' => $ilUser->getPref("ilPageEditor_MediaMode"), 'media_mode' => 'disable', 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     $output = str_replace("&lt;", "<", $output);
     $output = str_replace("&gt;", ">", $output);
     $output = str_replace("&amp;", "&", $output);
     if ($a_mode == "table_edit" && !is_null($a_table_obj)) {
         switch ($a_submode) {
             case "style":
                 $output = ilPCTableGUI::_addStyleCheckboxes($output, $a_table_obj);
                 break;
             case "alignment":
                 $output = ilPCTableGUI::_addAlignmentCheckboxes($output, $a_table_obj);
                 break;
             case "width":
                 $output = ilPCTableGUI::_addWidthInputs($output, $a_table_obj);
                 break;
             case "span":
                 $output = ilPCTableGUI::_addSpanInputs($output, $a_table_obj);
                 break;
         }
     }
     return '<div style="float:left;">' . $output . '</div>';
 }
 /**
  * start session
  * @global <type> $ilDB
  */
 public function startSession()
 {
     global $ilDB, $ilUser, $ilCtrl, $ilAccess;
     // Handle deleted accounts
     ilObjVitero::handleDeletedUsers();
     try {
         // Create update user
         $map = new ilViteroUserMapping();
         $vuid = $map->getVUserId($ilUser->getId());
         $ucon = new ilViteroUserSoapConnector();
         if (!$vuid) {
             $vuid = $ucon->createUser($ilUser);
             $map->map($ilUser->getId(), $vuid);
         } else {
             try {
                 $ucon->updateUser($vuid, $ilUser);
             } catch (ilViteroConnectorException $e) {
                 if ($e->getCode() == 53) {
                     $map->unmap($ilUser->getId());
                     $vuid = $ucon->createUser($ilUser);
                     $map->map($ilUser->getId(), $vuid);
                 }
             }
         }
         // Store update image
         if (ilViteroSettings::getInstance()->isAvatarEnabled()) {
             $usr_image_path = ilUtil::getWebspaceDir() . '/usr_images/usr_' . $ilUser->getId() . '.jpg';
             if (@file_exists($usr_image_path)) {
                 $ucon->storeAvatarUsingBase64($vuid, array('name' => 'usr_image.jpg', 'type' => ilViteroAvatarSoapConnector::FILE_TYPE_NORMAL, 'file' => $usr_image_path));
             }
         }
         /*
         			if(ilViteroSettings::getInstance()->isAvatarEnabled() and 0)
         			{
         				try {
         					$avatar_service = new ilViteroAvatarSoapConnector();
         					$usr_image_path = ilUtil::getWebspaceDir().'/usr_images/usr_'.$ilUser->getId().'.jpg';
         
         					if(@file_exists($usr_image_path))
         					{
         						$avatar_service->storeAvatar(
         							$vuid,
         							array(
         								'name' => 'usr_image.jpg',
         								'type' => ilViteroAvatarSoapConnector::FILE_TYPE_NORMAL,
         								'file' => $usr_image_path
         							)
         						);
         					}
         				}
         				catch(ilViteroConnectorException $e)
         				{
         					// continue
         				}
         			}
         */
         // Assign user to vitero group
         $grp = new ilViteroGroupSoapConnector();
         $grp->addUserToGroup($this->object->getVGroupId(), $vuid);
         $grp->changeGroupRole($this->object->getVGroupId(), $vuid, $ilAccess->checkAccess('write', '', $this->object->getRefId()) ? ilViteroGroupSoapConnector::ADMIN_ROLE : ilViteroGroupSoapConnector::MEMBER_ROLE);
         $sc = new ilViteroSessionCodeSoapConnector();
         $dur = new ilDateTime(time(), IL_CAL_UNIX);
         $dur->increment(IL_CAL_HOUR, 2);
         $code = $sc->createPersonalBookingSessionCode($vuid, (int) $_GET['bid'], $dur);
         $GLOBALS['ilLog']->write(__METHOD__ . ': ' . ilViteroSettings::getInstance()->getWebstartUrl() . '?code=' . $code);
         ilUtil::redirect(ilViteroSettings::getInstance()->getWebstartUrl() . '?sessionCode=' . $code);
     } catch (ilViteroConnectorException $e) {
         ilUtil::sendFailure($e->getViteroMessage(), true);
         $ilCtrl->redirect($this, 'infoScreen');
     }
 }
Example #14
0
 /**
  * Remove user picture.
  */
 function removeUserPicture()
 {
     $webspace_dir = ilUtil::getWebspaceDir();
     $image_dir = $webspace_dir . "/usr_images";
     $file = $image_dir . "/usr_" . $this->getID() . "." . "jpg";
     $thumb_file = $image_dir . "/usr_" . $this->getID() . "_small.jpg";
     $xthumb_file = $image_dir . "/usr_" . $this->getID() . "_xsmall.jpg";
     $xxthumb_file = $image_dir . "/usr_" . $this->getID() . "_xxsmall.jpg";
     $upload_file = $image_dir . "/upload_" . $this->getID();
     // remove user pref file name
     $this->setPref("profile_image", "");
     $this->update();
     if (@is_file($file)) {
         unlink($file);
     }
     if (@is_file($thumb_file)) {
         unlink($thumb_file);
     }
     if (@is_file($xthumb_file)) {
         unlink($xthumb_file);
     }
     if (@is_file($xxthumb_file)) {
         unlink($xxthumb_file);
     }
     if (@is_file($upload_file)) {
         unlink($upload_file);
     }
 }
 public function getOnlineLink($a_rel_name)
 {
     return ilUtil::getWebspaceDir('filesystem') . '/courses/' . $a_rel_name . '/index.html';
 }
 /**
  * copy multimedia object files from import zip file to mob directory
  */
 function copyMobFiles()
 {
     $imp_dir = $this->content_object->getImportDirectory();
     foreach ($this->mob_mapping as $origin_id => $mob_id) {
         if (empty($origin_id)) {
             continue;
         }
         /*
         			$origin_arr = explode("_", $origin_id);
         			if ($origin_arr[2] == "el") // imagemap
         			{
         				$obj_dir = "imagemap".$origin_arr[3];
         			}
         			else // normal media object
         			{
         				$obj_dir = "mm".$origin_arr[3];
         			}*/
         $obj_dir = $origin_id;
         $source_dir = $imp_dir . "/" . $this->subdir . "/objects/" . $obj_dir;
         $target_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $mob_id;
         //echo "copy from $source_dir to $target_dir <br>";
         if (@is_dir($source_dir)) {
             // make target directory
             ilUtil::makeDir($target_dir);
             //@mkdir($target_dir);
             //@chmod($target_dir, 0755);
             if (@is_dir($target_dir)) {
                 ilUtil::rCopy($source_dir, $target_dir);
             }
         }
     }
 }
 /**
  * @param $activeId
  * @param $pass
  * @return string
  */
 private function buildOverviewFilename($activeId, $pass)
 {
     return ilUtil::getWebspaceDir() . '/assessment/scores-' . $this->testOBJ->getId() . '-' . $activeId . '-' . $pass . '.pdf';
 }
 /**
  * @return string	path to smilies
  */
 public static function _getSmileyDir()
 {
     return ilUtil::getWebspaceDir() . '/chatroom/smilies';
 }
 function updateSocialBookmarkObject()
 {
     global $ilAccess, $rbacreview, $lng, $ilCtrl;
     if (!$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     include_once './Services/Administration/classes/class.ilSocialBookmarks.php';
     $form = ilSocialBookmarks::_initForm($this, 'update');
     if ($form->checkInput()) {
         $title = $form->getInput('title');
         $link = $form->getInput('link');
         $file = $form->getInput('image_file');
         $active = $form->getInput('activate');
         $id = $form->getInput('sbm_id');
         if (!$file['name']) {
             ilSocialBookmarks::_updateSocialBookmark($id, $title, $link, $active);
         } else {
             $extension = pathinfo($file['name'], PATHINFO_EXTENSION);
             $icon_path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons' . DIRECTORY_SEPARATOR . time() . '.' . $extension;
             $path = ilUtil::getWebspaceDir() . DIRECTORY_SEPARATOR . 'social_bm_icons';
             if (!is_dir($path)) {
                 ilUtil::createDirectory($path);
             }
             ilSocialBookmarks::_deleteImage($id);
             ilSocialBookmarks::_updateSocialBookmark($id, $title, $link, $active, $icon_path);
             ilUtil::moveUploadedFile($file['tmp_name'], $file['name'], $icon_path);
         }
         $this->editSocialBookmarksObject();
     } else {
         $this->__initSubTabs("editSocialBookmarks");
         $form->setValuesByPost();
         $this->tpl->setVariable('ADM_CONTENT', $form->getHTML());
     }
 }
 /**
  * Upload user image
  */
 function uploadUserPicture()
 {
     global $ilUser;
     if ($this->workWithUserSetting("upload")) {
         if (!$this->form->hasFileUpload("userfile")) {
             if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
                 $ilUser->removeUserPicture();
             }
             return;
         } else {
             $webspace_dir = ilUtil::getWebspaceDir();
             $image_dir = $webspace_dir . "/usr_images";
             $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
             // store filename
             $ilUser->setPref("profile_image", $store_file);
             $ilUser->update();
             // move uploaded file
             $uploaded_file = $this->form->moveFileUpload($image_dir, "userfile", "upload_" . $ilUser->getId() . "pic");
             if (!$uploaded_file) {
                 ilUtil::sendFailure($this->lng->txt("upload_error", true));
                 $this->ctrl->redirect($this, "showProfile");
             }
             chmod($uploaded_file, 0770);
             // take quality 100 to avoid jpeg artefacts when uploading jpeg files
             // taking only frame [0] to avoid problems with animated gifs
             $show_file = "{$image_dir}/usr_" . $ilUser->getId() . ".jpg";
             $thumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_small.jpg";
             $xthumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_xsmall.jpg";
             $xxthumb_file = "{$image_dir}/usr_" . $ilUser->getId() . "_xxsmall.jpg";
             $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
             $show_file = ilUtil::escapeShellArg($show_file);
             $thumb_file = ilUtil::escapeShellArg($thumb_file);
             $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
             $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
             if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
             } else {
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
                 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
             }
         }
     }
     //		$this->saveProfile();
 }
 /**
  * Deliver vcard information.
  */
 function deliverVCard()
 {
     // get user object
     if (!ilObject::_exists($this->getUserId())) {
         return "";
     }
     $user = new ilObjUser($this->getUserId());
     require_once "./Services/User/classes/class.ilvCard.php";
     $vcard = new ilvCard();
     // ilsharedresourceGUI: embedded in shared portfolio
     if ($user->getPref("public_profile") != "y" && $user->getPref("public_profile") != "g" && $_GET["baseClass"] != "ilsharedresourceGUI") {
         return;
     }
     $vcard->setName($user->getLastName(), $user->getFirstName(), "", $user->getUTitle());
     $vcard->setNickname($user->getLogin());
     $webspace_dir = ilUtil::getWebspaceDir("output");
     $imagefile = $webspace_dir . "/usr_images/" . $user->getPref("profile_image");
     if ($user->getPref("public_upload") == "y" && @is_file($imagefile)) {
         $fh = fopen($imagefile, "r");
         if ($fh) {
             $image = fread($fh, filesize($imagefile));
             fclose($fh);
             require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mimetype = ilObjMediaObject::getMimeType($imagefile);
             if (preg_match("/^image/", $mimetype)) {
                 $type = $mimetype;
             }
             $vcard->setPhoto($image, $type);
         }
     }
     $val_arr = array("getInstitution" => "institution", "getDepartment" => "department", "getStreet" => "street", "getZipcode" => "zipcode", "getCity" => "city", "getCountry" => "country", "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home", "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email", "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
     $org = array();
     $adr = array();
     foreach ($val_arr as $key => $value) {
         // if value "y" show information
         if ($user->getPref("public_" . $value) == "y") {
             switch ($value) {
                 case "institution":
                     $org[0] = $user->{$key}();
                     break;
                 case "department":
                     $org[1] = $user->{$key}();
                     break;
                 case "street":
                     $adr[2] = $user->{$key}();
                     break;
                 case "zipcode":
                     $adr[5] = $user->{$key}();
                     break;
                 case "city":
                     $adr[3] = $user->{$key}();
                     break;
                 case "country":
                     $adr[6] = $user->{$key}();
                     break;
                 case "phone_office":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_WORK);
                     break;
                 case "phone_home":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_HOME);
                     break;
                 case "phone_mobile":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_CELL);
                     break;
                 case "fax":
                     $vcard->setPhone($user->{$key}(), TEL_TYPE_FAX);
                     break;
                 case "email":
                     $vcard->setEmail($user->{$key}());
                     break;
                 case "hobby":
                     $vcard->setNote($user->{$key}());
                     break;
             }
         }
     }
     if (count($org)) {
         $vcard->setOrganization(join(";", $org));
     }
     if (count($adr)) {
         $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
     }
     ilUtil::deliverData(utf8_decode($vcard->buildVCard()), $vcard->getFilename(), $vcard->getMimetype());
 }
 public function show()
 {
     require_once 'class.ilTestEvaluationGUI.php';
     require_once './Services/PDFGeneration/classes/class.ilPDFGeneration.php';
     global $ilUser;
     if (array_key_exists("pass", $_GET) && strlen($_GET["pass"]) > 0 || !is_null($pass)) {
         if (is_null($pass)) {
             $pass = $_GET["pass"];
         }
     }
     $template = new ilTemplate("tpl.il_as_tst_submission_review.html", TRUE, TRUE, "Modules/Test");
     $this->ilCtrl->setParameter($this, "crs_show_result", $_GET['crs_show_result']);
     $this->ilCtrl->setParameter($this, "skipfinalstatement", 1);
     $template->setVariable("FORMACTION", $this->ilCtrl->getFormAction($this->testOutputGUI, 'redirectBack') . '&reviewed=1');
     $template->setVariable("BUTTON_CONTINUE", $this->lng->txt("btn_next"));
     $template->setVariable("BUTTON_BACK", $this->lng->txt("btn_previous"));
     $this->ilCtrl->setParameter($this, "pass", "");
     $this->ilCtrl->setParameter($this, "pdf", "");
     $active = $this->test->getActiveIdOfUser($ilUser->getId());
     $testevaluationgui = new ilTestEvaluationGUI($this->test);
     $results = $this->test->getTestResult($active, $pass);
     $results_output = $testevaluationgui->getPassListOfAnswers($results, $active, $pass, false, false, false, false);
     if ($this->test->getShowExamviewPdf()) {
         $template->setCurrentBlock("pdf_export");
         $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")));
         global $ilSetting;
         $inst_id = $ilSetting->get('inst_id', null);
         $path = ilUtil::getWebspaceDir() . '/assessment/' . $this->testOutputGUI->object->getId() . '/exam_pdf';
         if (!is_dir($path)) {
             ilUtil::makeDirParents($path);
         }
         $filename = $path . '/exam_N' . $inst_id . '-' . $this->testOutputGUI->object->getId() . '-' . $active . '-' . $pass . '.pdf';
         require_once 'class.ilTestPDFGenerator.php';
         ilTestPDFGenerator::generatePDF($results_output, ilTestPDFGenerator::PDF_OUTPUT_FILE, $filename);
         $template->setVariable("PDF_FILE_LOCATION", $filename);
     }
     if ($this->test->getShowExamviewHtml()) {
         $template->setCurrentBlock('html_review');
         $template->setVariable('HTML_REVIEW', $results_output);
     }
     $this->tpl->setVariable($this->getContentBlockName(), $template->get());
 }
 /**
  * show media object
  */
 function media($a_mode = "media")
 {
     $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->glossary->getStyleSheetId()));
     //$int_links = $page_object->getInternalLinks();
     $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
     // later
     //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
     $link_xlm = "";
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
     $xml = "<dummy>";
     // todo: we get always the first alias now (problem if mob is used multiple
     // times in page)
     $xml .= $media_obj->getXML(IL_MODE_ALIAS);
     $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
     $xml .= $link_xml;
     $xml .= "</dummy>";
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $xml, '/_xsl' => $xsl);
     $xh = xslt_create();
     if (!$this->offlineMode()) {
         $enlarge_path = ilUtil::getImagePath("enlarge.png", false, "output");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.png";
         $wb_path = "";
     }
     $mode = $a_mode;
     $this->ctrl->setParameter($this, "obj_type", "MediaObject");
     $fullscreen_link = $this->getLink($_GET["ref_id"], "fullscreen");
     $this->ctrl->clearParameters($this);
     $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => $fullscreen_link, 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     $this->tpl->setVariable("MEDIA_CONTENT", $output);
     $this->tpl->parseCurrentBlock();
     if ($this->offlineMode()) {
         $html = $this->tpl->get();
         return $html;
     }
 }
 /**
  * Export media object to html
  */
 function exportHTMLMOB($a_mob_id, &$a_linked_mobs)
 {
     global $tpl;
     $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
     if (@is_dir($source_dir)) {
         ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
         ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
     }
     // fullscreen
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob_obj = new ilObjMediaObject($a_mob_id);
     if ($mob_obj->hasFullscreenItem()) {
         $tpl = new ilTemplate("tpl.main.html", true, true);
         $tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
         $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
         // open file
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $content);
         fclose($fp);
     }
     $linked_mobs = $mob_obj->getLinkedMediaObjects();
     $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
 }
Example #25
0
 function getDataDirectory($mode = "filesystem")
 {
     $lm_data_dir = ilUtil::getWebspaceDir($mode) . "/lm_data";
     $lm_dir = $lm_data_dir . "/lm_" . $this->getId();
     return $lm_dir;
 }
 /**
  * show media object
  */
 function showMedia()
 {
     global $ilAccess;
     if (!$ilAccess->checkAccess("read", "", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->tpl =& new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
     include_once "Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     //$int_links = $page_object->getInternalLinks();
     $med_links = ilMediaItem::_getMapAreasIntLinks($_GET["mob_id"]);
     // later
     //$link_xml = $this->getLinkXML($med_links, $this->getLayoutLinkTargets());
     $link_xlm = "";
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     ilObjMediaObjectGUI::includePresentationJS($this->tpl);
     $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
     $xml = "<dummy>";
     // todo: we get always the first alias now (problem if mob is used multiple
     // times in page)
     $xml .= $media_obj->getXML(IL_MODE_ALIAS);
     $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
     $xml .= $link_xml;
     $xml .= "</dummy>";
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $xml, '/_xsl' => $xsl);
     $xh = xslt_create();
     $wb_path = ilUtil::getWebspaceDir("output") . "/";
     $mode = $_GET["cmd"] != "showMedia" ? "fullscreen" : "media";
     $enlarge_path = ilUtil::getImagePath("enlarge.png", false, "output");
     $fullscreen_link = $this->ctrl->getLinkTarget($this, "showFullscreen", "", false, false);
     $params = array('mode' => $mode, 'enlarge_path' => $enlarge_path, 'link_params' => "ref_id=" . $_GET["ref_id"], 'fullscreen_link' => $fullscreen_link, 'ref_id' => $_GET["ref_id"], 'pg_frame' => $pg_frame, 'webspace_path' => $wb_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     $this->tpl->setVariable("MEDIA_CONTENT", $output);
 }
Example #27
0
 /**
  * show fullscreen view of media object
  */
 function showMediaFullscreen($a_style_id = 0)
 {
     $this->tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
     $this->tpl->setCurrentBlock("ContentStyle");
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", 0);
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("PAGETITLE", " - " . ilObject::_lookupTitle($_GET["mob_id"]));
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->setCurrentBlock("ilMedia");
     require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $media_obj =& new ilObjMediaObject($_GET["mob_id"]);
     if (!empty($_GET["pg_id"])) {
         include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
         $pg_obj = ilPageObjectFactory::getInstance($this->obj->getParentType(), $_GET["pg_id"]);
         $pg_obj->buildDom();
         $xml = "<dummy>";
         // todo: we get always the first alias now (problem if mob is used multiple
         // times in page)
         $xml .= $pg_obj->getMediaAliasElement($_GET["mob_id"]);
         $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
         $xml .= "</dummy>";
     } else {
         $xml = "<dummy>";
         $xml .= $media_obj->getXML(IL_MODE_ALIAS);
         $xml .= $media_obj->getXML(IL_MODE_OUTPUT);
         $xml .= "</dummy>";
     }
     //echo htmlentities($xml); exit;
     $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
     $args = array('/_xml' => $xml, '/_xsl' => $xsl);
     $xh = xslt_create();
     //echo "<b>XML:</b>".htmlentities($xml);
     // determine target frames for internal links
     //$pg_frame = $_GET["frame"];
     $wb_path = ilUtil::getWebspaceDir("output") . "/";
     $mode = "fullscreen";
     $params = array('mode' => $mode, 'webspace_path' => $wb_path);
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
     echo xslt_error($xh);
     xslt_free($xh);
     // unmask user html
     $this->tpl->setVariable("MEDIA_CONTENT", $output);
 }
 /**
  * Export media object to html
  */
 function exportHTMLMOB($a_mob_id, &$a_linked_mobs)
 {
     global $tpl;
     $source_dir = ilUtil::getWebspaceDir() . "/mobs/mm_" . $a_mob_id;
     if (@is_dir($source_dir)) {
         ilUtil::makeDir($this->mobs_dir . "/mm_" . $a_mob_id);
         ilUtil::rCopy($source_dir, $this->mobs_dir . "/mm_" . $a_mob_id);
     }
     // #12930 - fullscreen
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob_obj = new ilObjMediaObject($a_mob_id);
     if ($mob_obj->hasFullscreenItem()) {
         // render media object html
         $xh = xslt_create();
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, array("/_xml" => "<dummy>" . $mob_obj->getXML(IL_MODE_ALIAS) . $mob_obj->getXML(IL_MODE_OUTPUT) . "</dummy>", "/_xsl" => file_get_contents("./Services/COPage/xsl/page.xsl")), array("mode" => "fullscreen"));
         xslt_free($xh);
         unset($xh);
         // render fullscreen html
         $tpl = new ilTemplate("tpl.fullscreen.html", true, true, "Services/COPage");
         $tpl = $this->getPreparedMainTemplate($tpl);
         // adds js/css
         $tpl->setCurrentBlock("ilMedia");
         $tpl->setVariable("MEDIA_CONTENT", $output);
         $output = $tpl->get();
         unset($tpl);
         // write file
         $file = $this->exp_dir . "/fullscreen_" . $a_mob_id . ".html";
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $output);
         fclose($fp);
         unset($fp);
         unset($output);
     }
     $linked_mobs = $mob_obj->getLinkedMediaObjects();
     $a_linked_mobs = array_merge($a_linked_mobs, $linked_mobs);
 }
 /**
  * return array with baseencoded picture data as key value, encoding type as encoding, and image type as key type.
  *
  * @param int $usr_id
  */
 private function getPictureValue($usr_id)
 {
     global $ilDB;
     // personal picture
     $q = sprintf("SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s", $ilDB->quote($usr_id, "integer"), $ilDB->quote('profile_image', "text"));
     $r = $ilDB->query($q);
     if ($ilDB->numRows($r) == 1) {
         $personal_picture_data = $r->fetchRow(DB_FETCHMODE_ASSOC);
         $personal_picture = $personal_picture_data["value"];
         $webspace_dir = ilUtil::getWebspaceDir();
         $image_file = $webspace_dir . "/usr_images/" . $personal_picture;
         if (@is_file($image_file)) {
             $fh = fopen($image_file, "rb");
             if ($fh) {
                 $image_data = fread($fh, filesize($image_file));
                 fclose($fh);
                 $base64 = base64_encode($image_data);
                 $imagetype = "image/jpeg";
                 if (preg_match("/.*\\.(png|gif)\$/", $personal_picture, $matches)) {
                     $imagetype = "image/" . $matches[1];
                 }
                 return array("value" => $base64, "encoding" => "Base64", "imagetype" => $imagetype);
             }
         }
     }
     return false;
 }
 /**
  * show print view
  */
 function showPrintView()
 {
     global $ilUser, $lng, $ilCtrl;
     include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
     if (!$this->lm->isActivePrintView()) {
         return;
     }
     $this->renderPageTitle();
     $c_obj_id = $this->getCurrentPageId();
     // set values according to selection
     if ($_POST["sel_type"] == "page") {
         if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) {
             $_POST["obj_id"][] = $c_obj_id;
         }
     }
     if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) {
         $path = $this->lm_tree->getPathFull($c_obj_id);
         $chap_id = $path[1]["child"];
         if ($chap_id > 0) {
             $_POST["obj_id"][] = $chap_id;
         }
     }
     //var_dump($_GET);
     //var_dump($_POST);
     // set style sheets
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle());
     } else {
         $style_name = $ilUser->getPref("style") . ".css";
         $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name);
     }
     // content style
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     // syntax style
     $this->tpl->setCurrentBlock("SyntaxStyle");
     $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $this->tpl->parseCurrentBlock();
     //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true);
     // set title header
     $this->tpl->setVariable("HEADER", $this->lm->getTitle());
     $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
     include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php";
     include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php";
     include_once "./Modules/LearningModule/classes/class.ilStructureObject.php";
     $act_level = 99999;
     $activated = false;
     $glossary_links = array();
     $output_header = false;
     $media_links = array();
     // get header and footer
     if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
         if (ilLMObject::_exists($this->lm->getFooterPage())) {
             $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage());
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm"));
             // determine target frames for internal links
             $page_object_gui->setLinkFrame($_GET["frame"]);
             $page_object_gui->setOutputMode("print");
             $page_object_gui->setPresentationTitle("");
             $page_object_gui->setFileDownloadLink("#");
             $page_object_gui->setFullscreenLink("#");
             $page_object_gui->setSourceCodeDownloadScript("#");
             $footer_page_content = $page_object_gui->showPage();
         }
     }
     if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) {
         if (ilLMObject::_exists($this->lm->getHeaderPage())) {
             $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage());
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm"));
             // determine target frames for internal links
             $page_object_gui->setLinkFrame($_GET["frame"]);
             $page_object_gui->setOutputMode("print");
             $page_object_gui->setPresentationTitle("");
             $page_object_gui->setFileDownloadLink("#");
             $page_object_gui->setFullscreenLink("#");
             $page_object_gui->setSourceCodeDownloadScript("#");
             $header_page_content = $page_object_gui->showPage();
         }
     }
     // add free selected pages
     if (is_array($_POST["obj_id"])) {
         foreach ($_POST["obj_id"] as $k) {
             if ($k > 0 && !$this->lm_tree->isInTree($k)) {
                 if (ilLMObject::_lookupType($k) == "pg") {
                     $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true);
                 }
             }
         }
     } else {
         ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true);
         $ilCtrl->redirect($this, "showPrintViewSelection");
     }
     foreach ($nodes as $node_key => $node) {
         // check page activation
         $active = ilLMPage::_lookupActive($node["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation"));
         if ($node["type"] == "pg" && !$active) {
             continue;
         }
         // print all subchapters/subpages if higher chapter
         // has been selected
         if ($node["depth"] <= $act_level) {
             if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) {
                 $act_level = $node["depth"];
                 $activated = true;
             } else {
                 $act_level = 99999;
                 $activated = false;
             }
         }
         if ($activated && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) {
             // output learning module header
             if ($node["type"] == "du") {
                 $output_header = true;
             }
             // output chapter title
             if ($node["type"] == "st") {
                 if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") {
                     if (!ilLMObject::_isPagePublic($node["obj_id"])) {
                         continue;
                     }
                 }
                 $chap = new ilStructureObject($this->lm, $node["obj_id"]);
                 $this->tpl->setCurrentBlock("print_chapter");
                 $chapter_title = $chap->_getPresentationTitle($node["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang);
                 $this->tpl->setVariable("CHAP_TITLE", $chapter_title);
                 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) {
                     if ($nodes[$node_key + 1]["type"] == "pg") {
                         $this->tpl->setVariable("CHAP_HEADER", $header_page_content);
                         $did_chap_page_header = true;
                     }
                 }
                 $this->tpl->parseCurrentBlock();
                 $this->tpl->setCurrentBlock("print_block");
                 $this->tpl->parseCurrentBlock();
             }
             // output page
             if ($node["type"] == "pg") {
                 if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") {
                     if (!ilLMObject::_isPagePublic($node["obj_id"])) {
                         continue;
                     }
                 }
                 $this->tpl->setCurrentBlock("print_item");
                 // get page
                 $page_id = $node["obj_id"];
                 $page_object_gui = $this->getLMPageGUI($page_id);
                 $page_object = $page_object_gui->getPageObject();
                 include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
                 $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm"));
                 // get lm page
                 $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
                 $lm_pg_obj->setLMId($this->lm->getId());
                 // determine target frames for internal links
                 $page_object_gui->setLinkFrame($_GET["frame"]);
                 $page_object_gui->setOutputMode("print");
                 $page_object_gui->setPresentationTitle("");
                 if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) {
                     $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang);
                     // prevent page title after chapter title
                     // that have the same content
                     if ($this->lm->isActiveNumbering()) {
                         $chapter_title = trim(substr($chapter_title, strpos($chapter_title, " ")));
                     }
                     if ($page_title != $chapter_title) {
                         $page_object_gui->setPresentationTitle($page_title);
                     }
                 }
                 // handle header / footer
                 $hcont = $header_page_content;
                 $fcont = $footer_page_content;
                 if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) {
                     if ($did_chap_page_header) {
                         $hcont = "";
                     }
                     if ($nodes[$node_key + 1]["type"] == "pg" && !($nodes[$node_key + 1]["depth"] <= $act_level && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) {
                         $fcont = "";
                     }
                 }
                 $page_object_gui->setFileDownloadLink("#");
                 $page_object_gui->setFullscreenLink("#");
                 $page_object_gui->setSourceCodeDownloadScript("#");
                 $page_content = $page_object_gui->showPage();
                 if ($this->lm->getPageHeader() != IL_PAGE_TITLE) {
                     $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont);
                 } else {
                     $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont . "<br />");
                 }
                 $chapter_title = "";
                 $this->tpl->parseCurrentBlock();
                 $this->tpl->setCurrentBlock("print_block");
                 $this->tpl->parseCurrentBlock();
                 // get internal links
                 $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]);
                 $got_mobs = false;
                 foreach ($int_links as $key => $link) {
                     if ($link["type"] == "git" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
                         $glossary_links[$key] = $link;
                     }
                     if ($link["type"] == "mob" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) {
                         $got_mobs = true;
                         $mob_links[$key] = $link;
                     }
                 }
                 // this is not cool because of performance reasons
                 // unfortunately the int link table does not
                 // store the target frame (we want to append all linked
                 // images but not inline images (i.e. mobs with no target
                 // frame))
                 if ($got_mobs) {
                     $page_object->buildDom();
                     $links = $page_object->getInternalLinks();
                     foreach ($links as $link) {
                         if ($link["Type"] == "MediaObject" && $link["TargetFrame"] != "" && $link["TargetFrame"] != "None") {
                             $media_links[] = $link;
                         }
                     }
                 }
             }
         }
     }
     $annex_cnt = 0;
     $annexes = array();
     // glossary
     if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) {
         include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         // sort terms
         $terms = array();
         foreach ($glossary_links as $key => $link) {
             $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]);
             $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term);
         }
         $terms = ilUtil::sortArray($terms, "term", "asc");
         //ksort($terms);
         foreach ($terms as $t) {
             $link = $t["link"];
             $key = $t["key"];
             $defs = ilGlossaryDefinition::getDefinitionList($link["id"]);
             $def_cnt = 1;
             // output all definitions of term
             foreach ($defs as $def) {
                 // definition + number, if more than 1 definition
                 if (count($defs) > 1) {
                     $this->tpl->setCurrentBlock("def_title");
                     $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . $def_cnt++);
                     $this->tpl->parseCurrentBlock();
                 }
                 include_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php";
                 $page_gui = new ilGlossaryDefPageGUI($def["id"]);
                 $page_gui->setTemplateOutput(false);
                 $page_gui->setOutputMode("print");
                 $this->tpl->setCurrentBlock("definition");
                 $page_gui->setFileDownloadLink("#");
                 $page_gui->setFullscreenLink("#");
                 $page_gui->setSourceCodeDownloadScript("#");
                 $output = $page_gui->showPage();
                 $this->tpl->setVariable("VAL_DEFINITION", $output);
                 $this->tpl->parseCurrentBlock();
             }
             // output term
             $this->tpl->setCurrentBlock("term");
             $this->tpl->setVariable("VAL_TERM", $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]));
             $this->tpl->parseCurrentBlock();
         }
         // output glossary header
         $annex_cnt++;
         $this->tpl->setCurrentBlock("glossary");
         $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo");
         $this->tpl->setVariable("TXT_GLOSSARY", $annex_title);
         $this->tpl->parseCurrentBlock();
         $annexes[] = $annex_title;
     }
     // referenced images
     if (count($media_links) > 0) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
         foreach ($media_links as $media) {
             if (substr($media["Target"], 0, 4) == "il__") {
                 $arr = explode("_", $media["Target"]);
                 $id = $arr[count($arr) - 1];
                 $med_obj = new ilObjMediaObject($id);
                 $med_item = $med_obj->getMediaItem("Standard");
                 if (is_object($med_item)) {
                     if (is_int(strpos($med_item->getFormat(), "image"))) {
                         $this->tpl->setCurrentBlock("ref_image");
                         // image source
                         if ($med_item->getLocationType() == "LocalFile") {
                             $this->tpl->setVariable("IMG_SOURCE", ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id . "/" . $med_item->getLocation());
                         } else {
                             $this->tpl->setVariable("IMG_SOURCE", $med_item->getLocation());
                         }
                         if ($med_item->getCaption() != "") {
                             $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption());
                         } else {
                             $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
                         }
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
         }
         // output glossary header
         $annex_cnt++;
         $this->tpl->setCurrentBlock("ref_images");
         $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images");
         $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title);
         $this->tpl->parseCurrentBlock();
         $annexes[] = $annex_title;
     }
     // output learning module title and toc
     if ($output_header) {
         $this->tpl->setCurrentBlock("print_header");
         $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle());
         if ($this->lm->getDescription() != "none") {
             include_once "Services/MetaData/classes/class.ilMD.php";
             $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
             $md_gen = $md->getGeneral();
             foreach ($md_gen->getDescriptionIds() as $id) {
                 $md_des = $md_gen->getDescription($id);
                 $description = $md_des->getDescription();
             }
             $this->tpl->setVariable("LM_DESCRIPTION", $description);
         }
         $this->tpl->parseCurrentBlock();
         // output toc
         $nodes2 = $nodes;
         foreach ($nodes2 as $node2) {
             if ($node2["type"] == "st" && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) {
                 for ($j = 1; $j < $node2["depth"]; $j++) {
                     $this->tpl->setCurrentBlock("indent");
                     $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
                     $this->tpl->parseCurrentBlock();
                 }
                 $this->tpl->setCurrentBlock("toc_entry");
                 $this->tpl->setVariable("TXT_TOC_TITLE", ilStructureObject::_getPresentationTitle($node2["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang));
                 $this->tpl->parseCurrentBlock();
             }
         }
         // annexes
         foreach ($annexes as $annex) {
             $this->tpl->setCurrentBlock("indent");
             $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png"));
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock("toc_entry");
             $this->tpl->setVariable("TXT_TOC_TITLE", $annex);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("toc");
         $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("print_start_block");
         $this->tpl->parseCurrentBlock();
     }
     // output author information
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
     if (is_object($lifecycle = $md->getLifecycle())) {
         $sep = $author = "";
         foreach ($ids = $lifecycle->getContributeIds() as $con_id) {
             $md_con = $lifecycle->getContribute($con_id);
             if ($md_con->getRole() == "Author") {
                 foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) {
                     $md_ent = $md_con->getEntity($ent_id);
                     $author = $author . $sep . $md_ent->getEntity();
                     $sep = ", ";
                 }
             }
         }
         if ($author != "") {
             $this->lng->loadLanguageModule("meta");
             $this->tpl->setCurrentBlock("author");
             $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author"));
             $this->tpl->setVariable("LM_AUTHOR", $author);
             $this->tpl->parseCurrentBlock();
         }
     }
     // output copyright information
     if (is_object($md_rights = $md->getRights())) {
         $copyright = $md_rights->getDescription();
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         $copyright = ilMDUtils::_parseCopyright($copyright);
         if ($copyright != "") {
             $this->lng->loadLanguageModule("meta");
             $this->tpl->setCurrentBlock("copyright");
             $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright"));
             $this->tpl->setVariable("LM_COPYRIGHT", $copyright);
             $this->tpl->parseCurrentBlock();
         }
     }
     $this->tpl->show(false);
 }