/** * Export page html */ function exportPageHTML($a_page_id) { global $ilUser, $lng, $ilTabs; $ilTabs->clearTargets(); $this->tpl = $this->co_page_html_export->getPreparedMainTemplate(); $this->tpl->getStandardTemplate(); $file = $this->export_dir . "/wpg_" . $a_page_id . ".html"; // return if file is already existing if (@is_file($file)) { return; } // page include_once "./Modules/Wiki/classes/class.ilWikiPageGUI.php"; $wpg_gui = new ilWikiPageGUI($a_page_id); $wpg_gui->setOutputMode("offline"); $page_content = $wpg_gui->showPage(); // export template: page content $ep_tpl = new ilTemplate("tpl.export_page.html", true, true, "Modules/Wiki"); $ep_tpl->setVariable("PAGE_CONTENT", $page_content); // export template: right content include_once "./Modules/Wiki/classes/class.ilWikiImportantPagesBlockGUI.php"; $bl = new ilWikiImportantPagesBlockGUI(); $ep_tpl->setVariable("RIGHT_CONTENT", $bl->getHTML(true)); // workaround // $this->tpl->setVariable("MAINMENU", "<div style='min-height:40px;'></div>"); $this->tpl->setVariable("MAINMENU", ""); $this->tpl->setTitle($this->wiki->getTitle()); $this->tpl->setTitleIcon("./images/icon_wiki.svg", $lng->txt("obj_wiki")); $this->tpl->setContent($ep_tpl->get()); //$this->tpl->fillMainContent(); $content = $this->tpl->get("DEFAULT", false, false, false, true, true, true); //echo htmlentities($content); exit; // 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 />"); } // set file permissions chmod($file, 0770); // write xml data into the file fwrite($fp, $content); // close file fclose($fp); if ($this->wiki->getStartPage() == $wpg_gui->getPageObject()->getTitle()) { copy($file, $this->export_dir . "/index.html"); } }
public function printViewObject($a_pdf_export = false) { global $tpl; $page_ids = $this->getPrintPageIds(); if (!$page_ids) { $this->ctrl->redirect($this, ""); } $tpl = new ilTemplate("tpl.main.html", true, true); $tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); $this->setContentStyleSheet($tpl); // syntax style $tpl->setCurrentBlock("SyntaxStyle"); $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $tpl->parseCurrentBlock(); // determine target frames for internal links include_once "./Modules/Wiki/classes/class.ilWikiPageGUI.php"; $page_content = ""; foreach ($page_ids as $p_id) { $page_gui = new ilWikiPageGUI($p_id); $page_gui->setOutputMode("print"); $page_content .= $page_gui->showPage(); if ($a_pdf_export) { $page_content .= '<p style="page-break-after:always;"></p>'; } } $page_content = '<div class="ilInvisibleBorder">' . $page_content . '</div>'; if (!$a_pdf_export) { $page_content .= '<script type="text/javascript" language="javascript1.2"> <!-- il.Util.addOnLoad(function () { il.Util.print(); }); //--> </script>'; } $tpl->setVariable("CONTENT", $page_content); if (!$a_pdf_export) { $tpl->show(false); exit; } else { return $tpl->get("DEFAULT", false, false, false, true, false, false); } }
static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null) { global $ilUser, $ilObjDataCache, $ilAccess; include_once "./Services/Notification/classes/class.ilNotification.php"; include_once "./Modules/Wiki/classes/class.ilObjWiki.php"; include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id); $wiki = new ilObjWiki($a_wiki_ref_id, true); $page = new ilWikiPage($a_page_id); // #11138 $ignore_threshold = $a_action == "comment"; // 1st update will be converted to new - see below if ($a_action == "new") { return; } if ($a_type == ilNotification::TYPE_WIKI_PAGE) { $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold); $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold); $users = array_merge($users, $wiki_users); if (!sizeof($users)) { return; } ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users); } else { $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold); if (!sizeof($users)) { return; } } ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id); // #15192 - should always be present if ($a_page_id) { include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php"; $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle()); } else { include_once "./Services/Link/classes/class.ilLink.php"; $link = ilLink::_getLink($a_wiki_ref_id); } include_once "./Services/Mail/classes/class.ilMail.php"; include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/Language/classes/class.ilLanguageFactory.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; // see ilBlogPostingGUI::getSnippet() // see ilBlogPosting::getNotificationAbstract() include_once "Modules/Wiki/classes/class.ilWikiPageGUI.php"; $pgui = new ilWikiPageGUI($page->getId()); $pgui->setRawPageContent(true); $pgui->setAbstractOnly(true); $pgui->setFileDownloadLink("."); $pgui->setFullscreenLink("."); $pgui->setSourcecodeDownloadScript("."); $snippet = $pgui->showPage(); $snippet = ilPageObject::truncateHTML($snippet, 500, "..."); // making things more readable $snippet = str_replace('<br/>', "\n", $snippet); $snippet = str_replace('<br />', "\n", $snippet); $snippet = str_replace('</p>', "\n", $snippet); $snippet = str_replace('</div>', "\n", $snippet); $snippet = trim(strip_tags($snippet)); // "fake" new (to enable snippet - if any) $current_version = array_shift($page->getHistoryEntries()); $current_version = $current_version["nr"]; if (!$current_version) { $a_type = ilNotification::TYPE_WIKI; $a_action = "new"; } foreach (array_unique($users) as $idx => $user_id) { if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) { // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($user_id); $ulng->loadLanguageModule('wiki'); $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle(), $page->getTitle()); $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n"; if ($a_type == ilNotification::TYPE_WIKI_PAGE) { // update/delete $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n"; $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n"; $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n"; $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n"; if ($snippet) { $message .= "\n" . $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n"; } // include comment/note text if ($a_comment) { $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n"; } $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link; } else { // new $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n"; $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n"; $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n"; $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n"; if ($snippet) { $message .= $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n\n"; } $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link; } $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system")); } else { unset($users[$idx]); } } }
/** * Show printable view of a wiki page */ function printViewObject() { $this->checkPermission("read"); switch ($_POST["sel_type"]) { case "wiki": include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $pages = ilWikiPage::getAllPages($this->object->getId()); foreach ($pages as $p) { $pg_ids[] = $p["id"]; } break; case "selection": if (is_array($_POST["obj_id"])) { $pg_ids = $_POST["obj_id"]; } else { $pg_ids[] = $_GET["wpg_id"]; } break; default: $pg_ids[] = $_GET["wpg_id"]; break; } include_once "./Modules/Wiki/classes/class.ilWikiPageGUI.php"; global $tpl; $tpl = new ilTemplate("tpl.main.html", true, true); $tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); $this->setContentStyleSheet($tpl); // syntax style $tpl->setCurrentBlock("SyntaxStyle"); $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $tpl->parseCurrentBlock(); // determine target frames for internal links foreach ($pg_ids as $p_id) { $page_gui = new ilWikiPageGUI($p_id); $page_gui->setOutputMode("print"); $page_content .= $page_gui->showPage(); } $tpl->setVariable("CONTENT", '<div class="ilInvisibleBorder">' . $page_content . '</div>' . '<script type="text/javascript" language="javascript1.2"> <!-- il.Util.addOnLoad(function () { il.Util.print(); }); //--> </script>'); $tpl->show(false); exit; }