/**
  * get html 
  * @return
  */
 public function getHTML()
 {
     global $lng;
     $lng->loadLanguageModule('webr');
     foreach ($this->getSubItemIds(true) as $sub_item) {
         if (is_object($this->getHighlighter()) and strlen($this->getHighlighter()->getContent($this->getObjId(), $sub_item))) {
             $this->tpl->setCurrentBlock('sea_fragment');
             $this->tpl->setVariable('TXT_FRAGMENT', $this->getHighlighter()->getContent($this->getObjId(), $sub_item));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock('subitem');
         $this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('webr'));
         $this->tpl->setVariable('SEPERATOR', ':');
         $link_data = ilLinkResourceItems::lookupItem($this->getObjId(), $sub_item);
         $link_data = ilParameterAppender::_append($link_data);
         // handle internal links (#10620)
         if (stristr($link_data["target"], "|")) {
             $parts = explode("|", $link_data["target"]);
             if ($parts[0] == "page") {
                 $parts[0] = "pg";
             }
             if ($parts[0] == "term") {
                 $parts[0] = "git";
             }
             $link_data["target"] = ilLink::_getStaticLink($parts[1], $parts[0]);
         }
         #$this->getItemListGUI()->setChildId($sub_item);
         $this->tpl->setVariable('LINK', $link_data['target']);
         $this->tpl->setVariable('TARGET', '_blank');
         $this->tpl->setVariable('TITLE', $link_data['title']);
         $this->tpl->parseCurrentBlock();
     }
     $this->showDetailsLink();
     return $this->tpl->get();
 }
 /**
  * Parse and send mail
  * @return 
  */
 public function send()
 {
     switch ($this->getType()) {
         case self::TYPE_NOTIFICATION_APPROVERS:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject($this->getLanguageText('reg_mail_new_user'));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_new_user_body'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_profile'));
                 $info = $this->getAdditionalInformation();
                 $this->appendBody("\n\n");
                 $this->appendBody($info['usr']->getProfileAsString($this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_reason'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->getMail()->enableSoap(false);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_CONFIRMATION:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject($this->getLanguageText('reg_mail_new_user_confirmation'));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_new_user_body'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_profile'));
                 $info = $this->getAdditionalInformation();
                 $this->appendBody("\n\n");
                 $this->appendBody($info['usr']->getProfileAsString($this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_confirmation'));
                 $this->appendBody("\n");
                 // #4527
                 include_once "Services/Link/classes/class.ilLink.php";
                 $this->appendBody(ilLink::_getStaticLink($info['usr']->getId(), "usrf"));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_reason'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->getMail()->enableSoap(false);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     /**
      * @var $ilAccess ilAccessHandler
      */
     global $ilAccess;
     $this->tpl->setVariable('USAGE_INSTANCE_TITLE', $row['title']);
     $this->tpl->setVariable('USAGE_AUTHOR', $row['author']);
     $this->tpl->setVariable('USAGE_PATH', $row['path']);
     if ($ilAccess->checkAccess('read', '', $row['ref_id']) && !$row['is_trashed']) {
         $link = new ilLink();
         $this->tpl->setVariable('USAGE_INSTANCE_LINKTED_TITLE', $row['title']);
         $this->tpl->setVariable('USAGE_INSTANCE_HREF', $link->_getStaticLink($row['ref_id'], 'tst'));
         $this->tpl->setCurrentBlock('linked_title_b');
         $this->tpl->touchBlock('linked_title_b');
         $this->tpl->parseCurrentBlock();
     }
 }
Exemplo n.º 4
0
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $lng, $ilAccess, $tpl, $ilNavigationHistory;
     $cmd = $this->ctrl->getCmd();
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "") {
         $this->ctrl->setCmdClass("ilobjwikigui");
         $next_class = $this->ctrl->getNextClass($this);
     }
     // add entry to navigation history
     if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
         $title = ilObject::_lookupTitle($obj_id);
         if ($_GET["page"] != "") {
             $page = $_GET["page"];
         } else {
             include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
             $page = ilObjWiki::_lookupStartPage($obj_id);
         }
         include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
         if (ilWikiPage::exists($obj_id, $page)) {
             include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
             $add = "_" . rawurlencode($page);
             $page_id = ilWikiPage::getPageIdForTitle($obj_id, $page);
             $ptitle = ilWikiPage::lookupTitle($page_id);
             $title .= ": " . $ptitle;
             $append = $_GET["page"] != "" ? "_" . ilWikiUtil::makeUrlTitle($page) : "";
             include_once './Services/Link/classes/class.ilLink.php';
             $goto = ilLink::_getStaticLink($_GET["ref_id"], "wiki", true, $append);
             //var_dump($goto);
             $ilNavigationHistory->addItem($_GET["ref_id"], "./goto.php?target=wiki_" . $_GET["ref_id"] . $add, "wiki", $title, $page_id, $goto);
         }
     }
     switch ($next_class) {
         case 'ilobjwikigui':
             require_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
             $mc_gui =& new ilObjWikiGUI("", (int) $_GET["ref_id"], true, false);
             $this->ctrl->forwardCommand($mc_gui);
             break;
     }
     $tpl->show();
 }
Exemplo n.º 5
0
 /**
  * Build posting month list
  * 
  * @param array $items
  * @param string $a_month
  * @param string $a_cmd
  * @param bool $a_link_template
  * @param bool $a_show_inactive
  * @return string 
  */
 function renderList(array $items, $a_month, $a_cmd = "preview", $a_link_template = null, $a_show_inactive = false)
 {
     global $lng, $ilCtrl;
     include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
     $wtpl = new ilTemplate("tpl.blog_list.html", true, true, "Modules/Blog");
     // title according to current "filter"/navigation
     if ($this->keyword) {
         $title = $lng->txt("blog_keyword") . ": " . $this->keyword;
     } else {
         if ($this->author) {
             include_once "Services/User/classes/class.ilUserUtil.php";
             $title = $lng->txt("blog_author") . ": " . ilUserUtil::getNamePresentation($this->author);
         } else {
             include_once "Services/Calendar/classes/class.ilCalendarUtil.php";
             $title = ilCalendarUtil::_numericMonthToString((int) substr($a_month, 5)) . " " . substr($a_month, 0, 4);
         }
     }
     $wtpl->setVariable("TXT_CURRENT_MONTH", $title);
     $can_approve = $this->object->hasApproval() && $this->checkPermissionBool("write");
     $can_deactivate = $this->checkPermissionBool("write");
     include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
     foreach ($items as $item) {
         // only published items
         $is_active = ilBlogPosting::_lookupActive($item["id"], "blp");
         if (!$is_active && !$a_show_inactive) {
             continue;
         }
         if (!$a_link_template) {
             $ilCtrl->setParameterByClass("ilblogpostinggui", "bmn", $this->month);
             $ilCtrl->setParameterByClass("ilblogpostinggui", "blpg", $item["id"]);
             $preview = $ilCtrl->getLinkTargetByClass("ilblogpostinggui", $a_cmd);
         } else {
             $preview = $this->buildExportLink($a_link_template, "posting", $item["id"]);
         }
         // actions
         $item_contribute = $this->mayContribute($item["id"], $item["author"]);
         if (($item_contribute || $can_approve || $can_deactivate) && !$a_link_template && $a_cmd == "preview") {
             include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
             $alist = new ilAdvancedSelectionListGUI();
             $alist->setId($item["id"]);
             $alist->setListTitle($lng->txt("actions"));
             if ($is_active && $this->object->hasApproval() && !$item["approved"]) {
                 if ($can_approve) {
                     $ilCtrl->setParameter($this, "apid", $item["id"]);
                     $alist->addItem($lng->txt("blog_approve"), "approve", $ilCtrl->getLinkTarget($this, "approve"));
                     $ilCtrl->setParameter($this, "apid", "");
                 }
                 $wtpl->setVariable("APPROVAL", $lng->txt("blog_needs_approval"));
             }
             if ($item_contribute) {
                 $alist->addItem($lng->txt("edit_content"), "edit", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edit"));
                 // #11858
                 if ($is_active) {
                     $alist->addItem($lng->txt("blog_toggle_draft"), "deactivate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deactivatePageToList"));
                 } else {
                     $alist->addItem($lng->txt("blog_toggle_final"), "activate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "activatePageToList"));
                 }
                 $alist->addItem($lng->txt("rename"), "rename", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "edittitle"));
                 $alist->addItem($lng->txt("blog_edit_keywords"), "keywords", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editKeywords"));
                 $alist->addItem($lng->txt("blog_edit_date"), "editdate", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "editdate"));
                 $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen"));
             } else {
                 if ($can_deactivate) {
                     // #10513
                     if ($is_active) {
                         $ilCtrl->setParameter($this, "apid", $item["id"]);
                         $alist->addItem($lng->txt("blog_toggle_draft_admin"), "deactivate", $ilCtrl->getLinkTarget($this, "deactivateAdmin"));
                         $ilCtrl->setParameter($this, "apid", "");
                     }
                     $alist->addItem($lng->txt("delete"), "delete", $ilCtrl->getLinkTargetByClass("ilblogpostinggui", "deleteBlogPostingConfirmationScreen"));
                 }
             }
             $wtpl->setCurrentBlock("actions");
             $wtpl->setVariable("ACTION_SELECTOR", $alist->getHTML());
             $wtpl->parseCurrentBlock();
         }
         // comments
         if ($this->object->getNotesStatus() && !$a_link_template && !$this->disable_notes) {
             // count (public) notes
             include_once "Services/Notes/classes/class.ilNote.php";
             $count = sizeof(ilNote::_getNotesOfObject($this->obj_id, $item["id"], "blp", IL_NOTE_PUBLIC));
             if ($a_cmd != "preview") {
                 $wtpl->setCurrentBlock("comments");
                 $wtpl->setVariable("TEXT_COMMENTS", $lng->txt("blog_comments"));
                 $wtpl->setVariable("URL_COMMENTS", $preview);
                 $wtpl->setVariable("COUNT_COMMENTS", $count);
                 $wtpl->parseCurrentBlock();
             }
             /* we disabled comments in edit mode (should always be done via pagegui)
             			else
             			{
             				$hash = ilCommonActionDispatcherGUI::buildAjaxHash(ilCommonActionDispatcherGUI::TYPE_WORKSPACE, 
             					$this->node_id, "blog", $this->obj_id, "blp", $item["id"]);
             				$notes_link = "#\" onclick=\"".ilNoteGUI::getListCommentsJSCall($hash);
             			}
             			*/
         }
         // permanent link
         if ($a_cmd != "preview" && $a_cmd != "previewEmbedded") {
             if ($this->id_type == self::WORKSPACE_NODE_ID) {
                 $goto = $this->getAccessHandler()->getGotoLink($this->node_id, $this->obj_id, "_" . $item["id"]);
             } else {
                 include_once "Services/Link/classes/class.ilLink.php";
                 $goto = ilLink::_getStaticLink($this->node_id, $this->getType(), true, "_" . $item["id"]);
             }
             $wtpl->setCurrentBlock("permalink");
             $wtpl->setVariable("URL_PERMALINK", $goto);
             $wtpl->setVariable("TEXT_PERMALINK", $lng->txt("blog_permanent_link"));
             $wtpl->parseCurrentBlock();
         }
         $snippet = ilBlogPostingGUI::getSnippet($item["id"]);
         if ($snippet) {
             $wtpl->setCurrentBlock("more");
             $wtpl->setVariable("URL_MORE", $preview);
             $wtpl->setVariable("TEXT_MORE", $lng->txt("blog_list_more"));
             $wtpl->parseCurrentBlock();
         }
         $wtpl->setCurrentBlock("posting");
         if (!$is_active) {
             $wtpl->setVariable("DRAFT_CLASS", " ilBlogListItemDraft");
         }
         $author = "";
         if ($this->id_type == self::REPOSITORY_NODE_ID) {
             $author_id = $item["author"];
             if ($author_id) {
                 include_once "Services/User/classes/class.ilUserUtil.php";
                 $author = ilUserUtil::getNamePresentation($author_id) . " - ";
             }
         }
         // title
         $wtpl->setVariable("URL_TITLE", $preview);
         $wtpl->setVariable("TITLE", $item["title"]);
         $wtpl->setVariable("DATETIME", $author . ilDatePresentation::formatDate($item["created"], IL_CAL_DATE));
         // content
         $wtpl->setVariable("CONTENT", $snippet);
         $wtpl->parseCurrentBlock();
     }
     // notes
     /*
     if($a_cmd == "previewFullscreen" && $this->object->getNotesStatus())
     {
     	$wtpl->setVariable("NOTES", $this->getNotesHTML());
     }		 
     */
     // permalink
     if ($a_cmd == "previewFullscreen") {
         $wtpl->setVariable("PERMALINK", $this->getPermanentLinkWidget(null, true));
     }
     return $wtpl->get();
 }
Exemplo n.º 6
0
 /**
  * Render main menu entry
  *
  * @param
  * @return
  */
 function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
 {
     global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
     $id = strtolower($a_id);
     $id_up = strtoupper($a_id);
     $a_tpl->setCurrentBlock("entry_" . $id);
     include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php";
     // repository
     if ($a_id == "repository") {
         $gl = new ilGroupedListGUI();
         $gl->setAsDropDown(true);
         include_once "./Services/Link/classes/class.ilLink.php";
         $icon = ilUtil::img(ilObject::_getIcon(ilObject::_lookupObjId(1), "tiny"));
         $gl->addEntry($icon . " " . $a_txt . " - " . $lng->txt("rep_main_page"), ilLink::_getStaticLink(1, 'root', true), "_top");
         $items = $ilNavigationHistory->getItems();
         reset($items);
         $cnt = 0;
         $first = true;
         foreach ($items as $k => $item) {
             if ($cnt >= 10) {
                 break;
             }
             if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) || ($item["ref_id"] != $_GET["ref_id"] || !$first)) {
                 if ($cnt == 0) {
                     $gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
                 }
                 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
                 $cnt++;
                 $icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
                 $ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true);
                 // #11023
                 $gl->addEntry($icon . " " . $ititle, $item["link"], "_top", "", "ilLVNavEnt");
             }
             $first = false;
         }
         if ($cnt > 0) {
             $gl->addEntry("» " . $lng->txt("remove_entries"), "#", "", "return il.MainMenu.removeLastVisitedItems('" . $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true) . "');", "ilLVNavEnt");
         }
         $a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
     }
     // desktop
     if ($a_id == "desktop") {
         $gl = new ilGroupedListGUI();
         $gl->setAsDropDown(true);
         // overview
         $gl->addEntry($lng->txt("overview"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems", "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"), "left center", "right center", false);
         // my groups and courses, if both is available
         if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
             $gl->addEntry($lng->txt("my_courses_groups"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships", "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"), "left center", "right center", false);
         }
         // bookmarks
         if (!$this->ilias->getSetting("disable_bookmarks")) {
             $gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks", "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"), "left center", "right center", false);
         }
         // private notes
         if (!$this->ilias->getSetting("disable_notes")) {
             $gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes", "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"), "left center", "right center", false);
         }
         // news
         if ($ilSetting->get("block_activated_news")) {
             $gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews", "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"), "left center", "right center", false);
         }
         // overview is always active
         $gl->addSeparator();
         $separator = false;
         if (!$ilSetting->get("disable_personal_workspace")) {
             // workspace
             $gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace", "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"), "left center", "right center", false);
             $separator = true;
         }
         // portfolio
         if ($ilSetting->get('user_portfolios')) {
             $gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio", "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"), "left center", "right center", false);
             $separator = true;
         }
         // skills
         $skmg_set = new ilSetting("skmg");
         if ($skmg_set->get("enable_skmg")) {
             $gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills", "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"), "left center", "right center", false);
             $separator = true;
         }
         // Learning Progress
         include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
         if (ilObjUserTracking::_enabledLearningProgress() && (ilObjUserTracking::_hasLearningProgressOtherUsers() || ilObjUserTracking::_hasLearningProgressLearner())) {
             //$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
             $gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP", "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"), "left center", "right center", false);
             $separator = true;
         }
         if ($separator) {
             $gl->addSeparator();
         }
         $separator = false;
         // calendar
         include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
         $settings = ilCalendarSettings::_getInstance();
         if ($settings->isEnabled()) {
             $gl->addEntry($lng->txt("calendar"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar", "_top", "", "", "mm_pd_cal", ilHelp::getMainMenuTooltip("mm_pd_cal"), "left center", "right center", false);
             $separator = true;
         }
         // mail
         if ($this->mail) {
             $gl->addEntry($lng->txt('mail'), 'ilias.php?baseClass=ilMailGUI', '_top', "", "", "mm_pd_mail", ilHelp::getMainMenuTooltip("mm_pd_mail"), "left center", "right center", false);
             $separator = true;
         }
         // contacts
         if (!$this->ilias->getSetting('disable_contacts') && ($this->ilias->getSetting('disable_contacts_require_mail') || $rbacsystem->checkAccess('internal_mail', ilMailGlobalServices::getMailObjectRefId()))) {
             $gl->addEntry($lng->txt('mail_addressbook'), 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToContacts', '_top', "", "", "mm_pd_contacts", ilHelp::getMainMenuTooltip("mm_pd_contacts"), "left center", "right center", false);
             $separator = true;
         }
         if ($separator) {
             $gl->addSeparator();
         }
         // profile
         $gl->addEntry($lng->txt("personal_profile"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile", "_top", "", "", "mm_pd_profile", ilHelp::getMainMenuTooltip("mm_pd_profile"), "left center", "right center", false);
         // settings
         $gl->addEntry($lng->txt("personal_settings"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings", "_top", "", "", "mm_pd_sett", ilHelp::getMainMenuTooltip("mm_pd_sett"), "left center", "right center", false);
         $a_tpl->setVariable("DESK_CONT_OV", $gl->getHTML());
     }
     if (IS_PAYMENT_ENABLED) {
         // shop
         if ($a_id == "shop") {
             $gl = new ilGroupedListGUI();
             $gl->setAsDropDown(true);
             // shop_content
             $gl->addEntry($lng->txt("content"), "ilias.php?baseClass=ilShopController&cmd=firstpage", "_top");
             // shoppingcart
             include_once 'Services/Payment/classes/class.ilPaymentShoppingCart.php';
             global $ilUser;
             $objShoppingCart = new ilPaymentShoppingCart($ilUser);
             $items = $objShoppingCart->getEntries();
             if (count($items) > 0) {
                 $gl->addEntry($lng->txt("shoppingcart") . ' (' . count($items) . ')', "ilias.php?baseClass=ilShopController&cmdClass=ilshopshoppingcartgui", "_top");
             }
             $a_tpl->setVariable("SHOP_CONT_OV", $gl->getHTML());
         }
     }
     $a_tpl->setVariable("TXT_" . $id_up, $a_txt);
     $a_tpl->setVariable("SCRIPT_" . $id_up, $a_script);
     $a_tpl->setVariable("TARGET_" . $id_up, $a_target);
     if ($this->active == $a_id || $this->active == "" && $a_id == "repository") {
         //$a_tpl->setVariable("MM_CLASS", "MMActive");
         $a_tpl->setVariable("SEL", '<span class="ilAccHidden">(' . $lng->txt("stat_selected") . ')</span>');
     } else {
         //$a_tpl->setVariable("MM_CLASS", "MMInactive");
     }
     if ($a_id == "repository") {
         include_once "./Services/Accessibility/classes/class.ilAccessKey.php";
         if (ilAccessKey::getKey(ilAccessKey::LAST_VISITED) != "") {
             $a_tpl->setVariable("ACC_KEY_REPOSITORY", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::LAST_VISITED) . '"');
         }
     }
     if ($a_id == "desktop") {
         include_once "./Services/Accessibility/classes/class.ilAccessKey.php";
         if (ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) != "") {
             $a_tpl->setVariable("ACC_KEY_DESKTOP", 'accesskey="' . ilAccessKey::getKey(ilAccessKey::PERSONAL_DESKTOP) . '"');
         }
     }
     $a_tpl->parseCurrentBlock();
 }
 /**
  * Fill table row
  *
  * @param array $a_set data array
  */
 protected function fillRow($node)
 {
     global $ilCtrl, $lng;
     $this->tpl->setVariable("LASTNAME", $node["lastname"]);
     $this->tpl->setVariable("FIRSTNAME", $node["firstname"]);
     $this->tpl->setVariable("LOGIN", $node["login"]);
     $this->tpl->setVariable("TITLE", $node["title"]);
     if (!$this->portfolio_mode) {
         $this->tpl->setVariable("TYPE", $node["obj_type"]);
         $this->tpl->setVariable("ICON_ALT", $node["obj_type"]);
         $this->tpl->setVariable("ICON", ilObject::_getIcon("", "tiny", $node["type"]));
         $url = $this->handler->getGotoLink($node["wsp_id"], $node["obj_id"]);
     } else {
         $url = ilLink::_getStaticLink($node["obj_id"], "prtf", true);
     }
     $this->tpl->setVariable("URL_TITLE", $url);
     $this->tpl->setVariable("ACL_DATE", ilDatePresentation::formatDate(new ilDateTime($node["acl_date"], IL_CAL_UNIX)));
     asort($node["acl_type"]);
     foreach ($node["acl_type"] as $obj_id) {
         // see ilWorkspaceAccessTableGUI
         switch ($obj_id) {
             case ilWorkspaceAccessGUI::PERMISSION_REGISTERED:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_registered");
                 $type = "registered";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all_password");
                 $type = "all_password";
                 $icon = "";
                 break;
             case ilWorkspaceAccessGUI::PERMISSION_ALL:
                 $title = $icon_alt = $this->lng->txt("wsp_set_permission_all");
                 $type = "all_password";
                 $icon = "";
                 break;
             default:
                 $type = ilObject::_lookupType($obj_id);
                 $icon = ilUtil::getTypeIconPath($type, null, "tiny");
                 $icon_alt = $this->lng->txt("obj_" . $type);
                 if ($type != "usr") {
                     $title = ilObject::_lookupTitle($obj_id);
                 } else {
                     $title = ilUserUtil::getNamePresentation($obj_id, true, true);
                 }
                 break;
         }
         if ($icon) {
             $this->tpl->setCurrentBlock("acl_type_icon_bl");
             $this->tpl->setVariable("ACL_ICON", $icon);
             $this->tpl->setVariable("ACL_ICON_ALT", $icon_alt);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("acl_type_bl");
         $this->tpl->setVariable("ACL_TYPE", $title);
         $this->tpl->parseCurrentBlock();
     }
     if (!$this->portfolio_mode) {
         // files may be copied to own workspace
         if ($node["type"] == "file") {
             $ilCtrl->setParameter($this->parent_obj, "wsp_id", $this->parent_node_id);
             $ilCtrl->setParameter($this->parent_obj, "item_ref_id", $node["wsp_id"]);
             $url = $ilCtrl->getLinkTarget($this->parent_obj, "copyshared");
             $this->tpl->setCurrentBlock("action_bl");
             $this->tpl->setVariable("URL_ACTION", $url);
             $this->tpl->setVariable("ACTION", $lng->txt("copy"));
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 /**
  * Deliver blog as rss feed
  * 
  * @param int $a_wsp_id
  */
 static function deliverRSS($a_wsp_id)
 {
     global $tpl, $ilSetting;
     if (!$ilSetting->get('enable_global_profiles')) {
         return;
     }
     // #10827
     if (substr($a_wsp_id, -4) != "_cll") {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         $wsp_id = new ilWorkspaceTree(0);
         $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
         $is_wsp = "_wsp";
     } else {
         $a_wsp_id = substr($a_wsp_id, 0, -4);
         $obj_id = ilObject::_lookupObjId($a_wsp_id);
         $is_wsp = null;
     }
     if (!$obj_id) {
         return;
     }
     $blog = new self($obj_id, false);
     if (!$blog->hasRSS()) {
         return;
     }
     include_once "Services/Feeds/classes/class.ilFeedWriter.php";
     $feed = new ilFeedWriter();
     include_once "Services/Link/classes/class.ilLink.php";
     $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
     $url = str_replace("&", "&amp;", $url);
     $feed->setChannelTitle($blog->getTitle());
     $feed->setChannelDescription($blog->getDescription());
     $feed->setChannelLink($url);
     // needed for blogpostinggui / pagegui
     $tpl = new ilTemplate("tpl.main.html", true, true);
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     include_once "./Modules/Blog/classes/class.ilBlogPostingGUI.php";
     foreach (ilBlogPosting::getAllPostings($obj_id) as $item) {
         $id = $item["id"];
         // only published items
         $is_active = ilBlogPosting::_lookupActive($id, "blp");
         if (!$is_active) {
             continue;
         }
         $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id));
         $snippet = str_replace("&", "&amp;", $snippet);
         $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_" . $id . $is_wsp);
         $url = str_replace("&", "&amp;", $url);
         $feed_item = new ilFeedItem();
         $feed_item->setTitle($item["title"]);
         $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
         $feed_item->setDescription($snippet);
         $feed_item->setLink($url);
         $feed_item->setAbout($url);
         $feed->addItem($feed_item);
     }
     $feed->showFeed();
     exit;
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     // owner
     if (!$this->shared) {
         $this->tpl->setCurrentBlock("title_form");
         $this->tpl->setVariable("VAL_ID", $a_set["id"]);
         $this->tpl->setVariable("VAL_TITLE", ilUtil::prepareFormOutput($a_set["title"]));
         $this->tpl->parseCurrentBlock();
         if (in_array($a_set["id"], $this->shared_objects)) {
             $this->tpl->setCurrentBlock("shared");
             $this->tpl->setVariable("TXT_SHARED", $lng->txt("wsp_status_shared"));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("chck");
         $this->tpl->setVariable("VAL_ID", $a_set["id"]);
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("edit");
         $this->tpl->setVariable("VAL_ID", $a_set["id"]);
         $this->tpl->setVariable("STATUS_ONLINE", $a_set["is_online"] ? " checked=\"checked\"" : "");
         $this->tpl->setVariable("VAL_DEFAULT", $a_set["is_default"] ? $lng->txt("yes") : "");
         $this->tpl->parseCurrentBlock();
         $ilCtrl->setParameter($this->parent_obj, "prt_id", $a_set["id"]);
         $this->tpl->setCurrentBlock("action");
         $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, "preview"));
         $this->tpl->setVariable("TXT_ACTION", $lng->txt("user_profile_preview"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, "pages"));
         $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_edit_portfolio"));
         $this->tpl->parseCurrentBlock();
         if ($a_set["is_online"]) {
             if (!$a_set["is_default"]) {
                 $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, "setDefaultConfirmation"));
                 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_set_as_default"));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $this->tpl->setVariable("URL_ACTION", $ilCtrl->getLinkTarget($this->parent_obj, "unsetDefault"));
                 $this->tpl->setVariable("TXT_ACTION", $lng->txt("prtf_unset_as_default"));
                 $this->tpl->parseCurrentBlock();
             }
         }
         $ilCtrl->setParameter($this->parent_obj, "prt_id", "");
     } else {
         $this->tpl->setCurrentBlock("title_static");
         $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
         $this->tpl->parseCurrentBlock();
         if ($a_set["password"]) {
             $this->tpl->setCurrentBlock("shared");
             $this->tpl->setVariable("TXT_SHARED", $lng->txt("wsp_password_protected_resource"));
             $this->tpl->parseCurrentBlock();
         }
         $link = ilLink::_getStaticLink($a_set["id"], "prtf", true);
         $this->tpl->setCurrentBlock("action");
         $this->tpl->setVariable("URL_ACTION", $link);
         $this->tpl->setVariable("TXT_ACTION", $lng->txt("view"));
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * send notifications about new EContent
  */
 protected function sendNewContentNotification($a_server_id)
 {
     include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php';
     $settings = ilECSSetting::getInstanceByServerId($a_server_id);
     if (!count($rcps = $settings->getEContentRecipients())) {
         return;
     }
     include_once './Services/Mail/classes/class.ilMail.php';
     include_once './Services/Language/classes/class.ilLanguageFactory.php';
     $lang = ilLanguageFactory::_getLanguage();
     $lang->loadLanguageModule('ecs');
     $mail = new ilMail(self::MAIL_SENDER);
     $message = $lang->txt('ecs_' . $this->getType() . '_created_body_a') . "\n\n";
     $message .= $lang->txt('title') . ': ' . $this->getTitle() . "\n";
     if (strlen($desc = $this->getDescription())) {
         $message .= $lang->txt('desc') . ': ' . $desc . "\n";
     }
     include_once './Services/Link/classes/class.ilLink.php';
     $href = ilLink::_getStaticLink($this->getRefId(), $this->getType(), true);
     $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n";
     $message .= ilMail::_getAutoGeneratedMessageString();
     $mail->sendMail($settings->getEContentRecipientsAsString(), '', '', $lang->txt('ecs_new_econtent_subject'), $message, array(), array('normal'));
 }
Exemplo n.º 11
0
 function getExerciseInfo($a_assignment_id, $a_add_submit = false)
 {
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($this->lng->txt("prtf_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if ($a_add_submit && !$times_up) {
         $this->ctrl->setParameter($this, "exc", $exercise_id);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $this->ctrl->getLinkTarget($this, "finalize");
         $this->ctrl->setParameter($this, "ass", "");
         $this->ctrl->setParameter($this, "exc", "");
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("prtf_finalize_portfolio");
         $button->setPrimary(true);
         $button->setUrl($submit_link);
         $info .= " " . $button->render();
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $this->user_id, true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcSubFile");
         $this->ctrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("download");
         $button->setUrl($dl_link);
         $info .= "<br />" . sprintf($this->lng->txt("prtf_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), $button->render());
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $this->ctrl->setParameter($this, "ass", $a_assignment_id);
             $this->ctrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcAssFile");
             $this->ctrl->setParameter($this, "file", "");
             $this->ctrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $this->lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->setAutoHide(false);
         // $overlay->setCloseElementId($cl_id);
         $overlay->add();
         // trigger
         $overlay->addTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $this->lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">" . $tooltip . "</div>";
     }
     return $info;
 }
 /**
  * Show user page
  */
 function preview($a_return = false, $a_content = false, $a_show_notes = true)
 {
     global $ilSetting;
     $portfolio_id = $this->object->getId();
     $user_id = $this->object->getOwner();
     $this->tabs_gui->clearTargets();
     $pages = ilPortfolioPage::getAllPages($portfolio_id);
     $current_page = (int) $_GET["user_page"];
     // validate current page
     if ($pages && $current_page) {
         $found = false;
         foreach ($pages as $page) {
             if ($page["id"] == $current_page) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             $current_page = null;
         }
     }
     // display first page of portfolio if none given
     if (!$current_page && $pages) {
         $current_page = $pages;
         $current_page = array_shift($current_page);
         $current_page = $current_page["id"];
     }
     // #13788 - keep page after login
     if ($this->user_id == ANONYMOUS_USER_ID && $this->getType() == "prtf") {
         $this->tpl->setLoginTargetPar("prtf_" . $this->object->getId() . "_" . $current_page);
     }
     // public profile
     if ($_REQUEST["back_url"]) {
         $back = $_REQUEST["back_url"];
     } else {
         if ($_GET["baseClass"] != "ilPublicUserProfileGUI" && $this->user_id && $this->user_id != ANONYMOUS_USER_ID) {
             if (!$this->checkPermissionBool("write")) {
                 // shared
                 if ($this->getType() == "prtf") {
                     $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", $this->object->getOwner());
                     $back = $this->ctrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui"), "showOther");
                     $this->ctrl->setParameterByClass("ilportfoliorepositorygui", "shr_id", "");
                 } else {
                     // #12819
                     global $tree;
                     $parent_id = $tree->getParentId($this->node_id);
                     include_once "Services/Link/classes/class.ilLink.php";
                     $back = ilLink::_getStaticLink($parent_id);
                 }
             } else {
                 $back = $this->ctrl->getLinkTarget($this, "view");
             }
         }
     }
     global $ilMainMenu;
     $ilMainMenu->setMode(ilMainMenuGUI::MODE_TOPBAR_ONLY);
     if ($back) {
         // might already be set in ilPublicUserProfileGUI
         $ilMainMenu->setTopBarBack($back);
     }
     // render tabs
     $current_blog = null;
     if (count($pages) > 1) {
         foreach ($pages as $p) {
             if ($p["type"] == ilPortfolioPage::TYPE_BLOG) {
                 // needed for blog comments (see below)
                 if ($p["id"] == $current_page) {
                     $current_blog = (int) $p["title"];
                 }
                 include_once "Modules/Blog/classes/class.ilObjBlog.php";
                 $p["title"] = ilObjBlog::_lookupTitle($p["title"]);
             }
             $this->ctrl->setParameter($this, "user_page", $p["id"]);
             $this->tabs_gui->addTab("user_page_" . $p["id"], $p["title"], $this->ctrl->getLinkTarget($this, "preview"));
         }
         $this->tabs_gui->activateTab("user_page_" . $current_page);
     }
     $this->ctrl->setParameter($this, "user_page", $current_page);
     if (!$a_content) {
         // get current page content
         $page_gui = $this->getPageGUIInstance($current_page);
         $page_gui->setEmbedded(true);
         $content = $this->ctrl->getHTML($page_gui);
     } else {
         $content = $a_content;
     }
     if ($a_return && $this->checkPermissionBool("write")) {
         return $content;
     }
     // blog posting comments are handled within the blog
     $notes = "";
     if ($a_show_notes && $this->object->hasPublicComments() && !$current_blog) {
         include_once "./Services/Notes/classes/class.ilNoteGUI.php";
         $note_gui = new ilNoteGUI($portfolio_id, $current_page, "pfpg");
         $note_gui->setRepositoryMode(false);
         $note_gui->enablePublicNotes(true);
         $note_gui->enablePrivateNotes(false);
         $note_gui->enablePublicNotesDeletion($this->user_id == $user_id && $ilSetting->get("comments_del_tutor", 1));
         $next_class = $this->ctrl->getNextClass($this);
         if ($next_class == "ilnotegui") {
             $notes = $this->ctrl->forwardCommand($note_gui);
         } else {
             $notes = $note_gui->getNotesHTML();
         }
     }
     if ($this->perma_link === null) {
         if ($this->getType() == "prtf") {
             $this->tpl->setPermanentLink($this->getType(), $this->object->getId(), "_" . $current_page);
         } else {
             $this->tpl->setPermanentLink($this->getType(), $this->object->getRefId());
         }
     } else {
         $this->tpl->setPermanentLink($this->perma_link["type"], $this->perma_link["obj_id"]);
     }
     self::renderFullscreenHeader($this->object, $this->tpl, $user_id);
     // #13564
     $this->ctrl->setParameter($this, "user_page", "");
     $this->tpl->setTitleUrl($this->ctrl->getLinkTarget($this, "preview"));
     $this->ctrl->setParameter($this, "user_page", $this->page_id);
     // blog pages do their own (page) style handling
     if (!$current_blog) {
         $content = '<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">' . '<div class="ilc_page_Page">' . $content . '</div></div>';
         $this->setContentStyleSheet($this->tpl);
     }
     // #10717
     $this->tpl->setContent($content . '<div class="ilClearFloat">' . $notes . '</div>');
 }
 /**
  * Get HTML for link
  */
 function getHTML()
 {
     global $lng, $ilCtrl, $ilObjDataCache;
     $tpl = new ilTemplate("tpl.permanent_link.html", true, true, "Services/PermanentLink");
     include_once './Services/Link/classes/class.ilLink.php';
     $href = ilLink::_getStaticLink($this->getId(), $this->getType(), true, $this->getAppend());
     if ($this->getIncludePermanentLinkText()) {
         $tpl->setVariable("TXT_PERMA", $lng->txt("perma_link") . ":");
     }
     $title = '';
     // fetch default title for bookmark
     if ($this->getTitle() != "") {
         $title = $this->getTitle();
     } else {
         $obj_id = $ilObjDataCache->lookupObjId($this->getId());
         $title = $ilObjDataCache->lookupTitle($obj_id);
     }
     #if (!$title)
     #	$bookmark->setTitle("untitled");
     $tpl->setVariable("TXT_BOOKMARK_DEFAULT", $title);
     $tpl->setVariable("LINK", $href);
     if ($this->getAlignCenter()) {
         $tpl->setVariable("ALIGN", "center");
     } else {
         $tpl->setVariable("ALIGN", "left");
     }
     if ($this->getTarget() != "") {
         $tpl->setVariable("TARGET", 'target="' . $this->getTarget() . '"');
     }
     // bookmark links
     $bm_html = self::_getBookmarksSelectionList($title, $href);
     if ($bm_html) {
         $tpl->setVariable('SELECTION_LIST', $bm_html);
     }
     return $tpl->get();
 }
 /**
  * Fill table row
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $this->tpl->setCurrentBlock("cmd");
     $this->tpl->setVariable("TXT_CMD", $lng->txt("edit"));
     $ilCtrl->setParameter($this->parent_obj, "level_id", $a_set["id"]);
     $this->tpl->setVariable("HREF_CMD", $ilCtrl->getLinkTarget($this->parent_obj, "editLevel"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("ID", $a_set["id"]);
     $this->tpl->setVariable("VAL_NR", (int) $a_set["nr"] * 10);
     $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
     $this->tpl->setVariable("TXT_DESCRIPTION", $a_set["description"]);
     /*		$this->tpl->setVariable("TXT_CERTIFICATE",
     			ilBasicSkill::_lookupCertificate($this->skill->getId(),
     			$a_set["id"])
     			? $lng->txt("yes")
     			: $lng->txt("no"));*/
     /*		$trigger = ilBasicSkill::lookupLevelTrigger((int) $a_set["id"]);
     		if (ilObject::_lookupType($trigger["obj_id"]) != "crs" ||
     			ilObject::_isInTrash($trigger["ref_id"]))
     		{
     			$trigger = array();
     		}
     
     		// trigger
     		if ($trigger["obj_id"] > 0)
     		{
     			$this->tpl->setVariable("TXT_TRIGGER",
     				ilObject::_lookupTitle($trigger["obj_id"]));
     		}*/
     if (is_array($a_set["ressources"])) {
         $this->tpl->setCurrentBlock("ressource_bl");
         foreach ($a_set["ressources"] as $rref_id) {
             $robj_id = ilObject::_lookupObjId($rref_id);
             $this->tpl->setVariable("RSRC_IMG", ilUtil::img(ilObject::_getIcon($robj_id, "tiny")));
             $this->tpl->setVariable("RSRC_TITLE", ilObject::_lookupTitle($robj_id));
             $this->tpl->setVariable("RSRC_URL", ilLink::_getStaticLink($rref_id));
             $this->tpl->parseCurrentBlock();
         }
     }
 }
 function sendNotificationMail($user_id, $anonymize_id)
 {
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     $recipients = preg_split('/,/', $this->mailaddresses);
     foreach ($recipients as $recipient) {
         $messagetext = $this->mailparticipantdata;
         $data = ilObjUser::_getUserData(array($user_id));
         foreach ($data[0] as $key => $value) {
             if ($this->getAnonymize()) {
                 $messagetext = str_replace('[' . $key . ']', '', $messagetext);
             } else {
                 $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
             }
         }
         $active_id = $this->getActiveID($user_id, $anonymize_id);
         $messagetext .= (strlen($messagetext) ? "\n\n\n" : '') . $this->lng->txt('results') . "\n\n" . $this->getParticipantTextResults($active_id);
         // #11298
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getStaticLink($this->getRefId(), "svy");
         $messagetext .= "\n\n" . $this->lng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
         $messagetext .= "\n" . $this->lng->txt('survey_notification_tutor_link') . ": " . $link;
         $mail->appendInstallationSignature(true);
         $mail->sendMail($recipient, "", "", $this->lng->txt('finished_mail_subject') . ': ' . $this->getTitle(), $messagetext, array(), array('normal'));
     }
 }
 /**
  * send notifications about new EContent
  *
  * @return bool
  */
 protected function sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id)
 {
     global $ilLog;
     if (!count($rcps = $a_server->getApprovalRecipients())) {
         return true;
     }
     include_once './Services/Mail/classes/class.ilMail.php';
     include_once './Services/Language/classes/class.ilLanguageFactory.php';
     $lang = ilLanguageFactory::_getLanguage();
     $lang->loadLanguageModule('ecs');
     // @TODO: read mail
     $mail = new ilMail(self::MAIL_SENDER);
     $message = $lang->txt('ecs_export_created_body_a') . "\n\n";
     $message .= $lang->txt('title') . ': ' . $this->content_obj->getTitle() . "\n";
     if (strlen($desc = $this->content_obj->getDescription())) {
         $message .= $lang->txt('desc') . ': ' . $desc . "\n";
     }
     // Participant info
     $message .= "\n" . $lang->txt('ecs_published_for');
     try {
         $found = false;
         $receivers = null;
         include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
         $details = ilECSEContentDetails::getInstance($a_server->getServerId(), $a_econtent_id, $this->getECSObjectType());
         if ($details instanceof ilECSEContentDetails) {
             $receivers = $details->getReceivers();
         }
         if ($receivers) {
             foreach ($receivers as $member) {
                 $found = true;
                 include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
                 $part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member);
                 $message .= "\n\n" . $part->getParticipantName() . "\n";
                 $message .= $part->getDescription();
             }
         }
         if ($found) {
             $message .= "\n\n";
         } else {
             $message .= ' ' . $lang->txt('ecs_not_published') . "\n\n";
         }
     } catch (ilECSConnectorException $e) {
         $ilLog->write(__METHOD__ . ': Cannot read approvements.');
         return false;
     }
     include_once './Services/Link/classes/class.ilLink.php';
     $href = ilLink::_getStaticLink($this->content_obj->getRefId(), 'crs', true);
     $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n";
     $message .= ilMail::_getAutoGeneratedMessageString();
     $mail->sendMail($a_server->getApprovalRecipientsAsString(), '', '', $lang->txt('ecs_new_approval_subject'), $message, array(), array('normal'));
     return true;
 }
Exemplo n.º 17
0
 /**
  *
  * @global ilCtrl $ilCtrl
  * @param <type> $gui
  * @param <type> $scope_id
  */
 public function getChatURL($gui, $scope_id = 0)
 {
     include_once 'Services/Link/classes/class.ilLink.php';
     $url = '';
     if (is_object($gui)) {
         if ($scope_id) {
             $url = ilLink::_getStaticLink($gui->object->getRefId(), $gui->object->getType(), true, '_' . $scope_id);
         } else {
             $url = ilLink::_getStaticLink($gui->object->getRefId(), $gui->object->getType());
         }
     }
     return $url;
 }
 /**
  * get HTML
  *
  * @access public
  * @param 
  * @return
  */
 public function getHTML($a_app)
 {
     global $tree, $lng, $ilUser;
     self::$counter++;
     $this->tpl = new ilTemplate('tpl.appointment_panel.html', true, true, 'Services/Calendar');
     // Panel variables
     $this->tpl->setVariable('PANEL_NUM', self::$counter);
     $this->tpl->setVariable('PANEL_TITLE', str_replace(' ()', '', $a_app['event']->getPresentationTitle(false)));
     if ($a_app["event"]->isMilestone()) {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_ms_details'));
     } else {
         $this->tpl->setVariable('PANEL_DETAILS', $this->lng->txt('cal_details'));
     }
     $this->tpl->setVariable('PANEL_TXT_DATE', $this->lng->txt('date'));
     if ($a_app['fullday']) {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDate($a_app['dstart'], IL_CAL_UNIX), new ilDate($a_app['dend'], IL_CAL_UNIX)));
     } else {
         $this->tpl->setVariable('PANEL_DATE', ilDatePresentation::formatPeriod(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)));
     }
     if ($a_app['event']->getLocation()) {
         $this->tpl->setVariable('PANEL_TXT_WHERE', $this->lng->txt('cal_where'));
         $this->tpl->setVariable('PANEL_WHERE', ilUtil::makeClickable($a_app['event']->getLocation()), true);
     }
     if ($a_app['event']->getDescription()) {
         $this->tpl->setVariable('PANEL_TXT_DESC', $this->lng->txt('description'));
         $this->tpl->setVariable('PANEL_DESC', ilUtil::makeClickable(nl2br($a_app['event']->getDescription())));
     }
     if ($a_app['event']->isMilestone() && $a_app['event']->getCompletion() > 0) {
         $this->tpl->setVariable('PANEL_TXT_COMPL', $this->lng->txt('cal_task_completion'));
         $this->tpl->setVariable('PANEL_COMPL', $a_app['event']->getCompletion() . " %");
     }
     if ($a_app['event']->isMilestone()) {
         // users responsible
         $users = $a_app['event']->readResponsibleUsers();
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $this->tpl->setVariable('PANEL_TXT_RESP', $this->lng->txt('cal_responsible'));
             $this->tpl->setVariable('PANEL_RESP', $value);
         }
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $cat_id = ilCalendarCategoryAssignments::_lookupCategory($a_app['event']->getEntryId());
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
     $entry_obj_id = isset($cat_info['subitem_obj_ids'][$cat_id]) ? $cat_info['subitem_obj_ids'][$cat_id] : $cat_info['obj_id'];
     $this->tpl->setVariable('PANEL_TXT_CAL_TYPE', $this->lng->txt('cal_cal_type'));
     switch ($cat_info['type']) {
         case ilCalendarCategory::TYPE_GLOBAL:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_system'));
             break;
         case ilCalendarCategory::TYPE_USR:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_personal'));
             break;
         case ilCalendarCategory::TYPE_OBJ:
             $type = ilObject::_lookupType($cat_info['obj_id']);
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_type_' . $type));
             // Course group appointment registration
             if ($this->settings->isCGRegistrationEnabled() and $type == 'crs' or type == 'grp') {
                 if (!$a_app['event']->isAutoGenerated()) {
                     include_once './Services/Calendar/classes/class.ilCalendarRegistration.php';
                     $reg = new ilCalendarRegistration($a_app['event']->getEntryId());
                     if ($reg->isRegistered($ilUser->getId(), new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_reg_unregister'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmUnregister'));
                         $this->tpl->parseCurrentBlock();
                     } else {
                         $this->tpl->setCurrentBlock('panel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dstart', $a_app['dstart']);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dend', $a_app['dend']);
                         $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_reg_register'));
                         $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'confirmRegister'));
                         $this->tpl->parseCurrentBlock();
                     }
                     include_once './Services/Link/classes/class.ilLink.php';
                     $registrations = array();
                     foreach ($reg->getRegisteredUsers(new ilDateTime($a_app['dstart'], IL_CAL_UNIX), new ilDateTime($a_app['dend'], IL_CAL_UNIX)) as $usr_data) {
                         $usr_id = $usr_data['usr_id'];
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $usr_id);
                         $registrations[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($usr_id);
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     }
                     if (count($registrations)) {
                         $this->tpl->setCurrentBlock('panel_current_booking');
                         $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_reg_registered_users'));
                         $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $registrations));
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
             break;
         case ilCalendarCategory::TYPE_CH:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_ch'));
             include_once 'Services/Booking/classes/class.ilBookingEntry.php';
             $entry = new ilBookingEntry($a_app['event']->getContextId());
             $is_owner = $entry->isOwner();
             $user_entry = $cat_info['obj_id'] == $ilUser->getId();
             if ($user_entry && !$is_owner) {
                 // find source calendar entry in owner calendar
                 include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
                 $apps = ilConsultationHourAppointments::getAppointmentIds($entry->getObjId(), $a_app['event']->getContextId(), $a_app['event']->getStart());
                 $ref_event = $apps[0];
             } else {
                 $ref_event = $a_app['event']->getEntryId();
             }
             $this->tpl->setCurrentBlock('panel_booking_owner');
             $this->tpl->setVariable('PANEL_TXT_BOOKING_OWNER', $this->lng->txt('cal_ch_booking_owner'));
             $this->tpl->setVariable('PANEL_BOOKING_OWNER', ilObjUser::_lookupFullname($entry->getObjId()));
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock('panel_max_booking');
             $this->tpl->setVariable('PANEL_TXT_MAX_BOOKING', $this->lng->txt('cal_ch_num_bookings'));
             $this->tpl->setVariable('PANEL_MAX_BOOKING', $entry->getNumberOfBookings());
             $this->tpl->parseCurrentBlock();
             if (!$is_owner) {
                 if ($entry->hasBooked($ref_event)) {
                     if (ilDateTime::_after($a_app['event']->getStart(), new ilDateTime(time(), IL_CAL_UNIX))) {
                         $this->tpl->setCurrentBlock('panel_cancel_book_link');
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                         $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
                         $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
                         $this->tpl->parseCurrentBlock();
                     }
                 } elseif ($entry->isAppointmentBookableForUser($ref_event, $GLOBALS['ilUser']->getId())) {
                     $this->tpl->setCurrentBlock('panel_book_link');
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $ref_event);
                     $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
                     $this->tpl->setVariable('TXT_PANEL_BOOK', $this->lng->txt('cal_ch_book'));
                     $this->tpl->setVariable('PANEL_BOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'book'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', $entry->getCurrentNumberOfBookings($ref_event));
                 $this->tpl->parseCurrentBlock();
             } else {
                 $obj_ids = $entry->getTargetObjIds();
                 foreach ($obj_ids as $obj_id) {
                     $title = ilObject::_lookupTitle($obj_id);
                     $refs = ilObject::_getAllReferences($obj_id);
                     include_once './Services/Link/classes/class.ilLink.php';
                     $this->tpl->setCurrentBlock('panel_booking_target_row');
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET_TITLE', $title);
                     $this->tpl->setVariable('PANEL_BOOKING_TARGET', ilLink::_getLink(end($refs)));
                     $this->tpl->parseCurrentBlock();
                 }
                 if ($obj_ids) {
                     $this->tpl->setCurrentBlock('panel_booking_target');
                     $this->tpl->setVariable('PANEL_TXT_BOOKING_TARGET', $this->lng->txt('cal_ch_target_object'));
                     $this->tpl->parseCurrentBlock();
                 }
                 $link_users = true;
                 if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) {
                     $link_users = false;
                 }
                 include_once './Services/Link/classes/class.ilLink.php';
                 $bookings = array();
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', 1);
                 foreach ($entry->getCurrentBookings($a_app['event']->getEntryId()) as $user_id) {
                     if ($link_users) {
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', $user_id);
                         $bookings[] = '<a href="' . $this->ctrl->getLinkTargetByClass('ilconsultationhoursgui', 'showprofile') . '">' . ilObjUser::_lookupFullname($user_id) . '</a>';
                         $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'user', '');
                     } else {
                         $bookings[] = ilObjUser::_lookupFullname($user_id);
                     }
                 }
                 $this->ctrl->setParameterByClass('ilconsultationhoursgui', 'panel', '');
                 $this->tpl->setCurrentBlock('panel_current_booking');
                 $this->tpl->setVariable('PANEL_TXT_CURRENT_BOOKING', $this->lng->txt('cal_ch_current_bookings'));
                 $this->tpl->setVariable('PANEL_CURRENT_BOOKING', implode('<br />', $bookings));
                 $this->tpl->parseCurrentBlock();
             }
             break;
         case ilCalendarCategory::TYPE_BOOK:
             $this->tpl->setVariable('PANEL_CAL_TYPE', $this->lng->txt('cal_ch_booking'));
             $this->tpl->setCurrentBlock('panel_cancel_book_link');
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
             $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
             $this->tpl->setVariable('TXT_PANEL_CANCELBOOK', $this->lng->txt('cal_ch_cancel_booking'));
             $this->tpl->setVariable('PANEL_CANCELBOOK_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking'));
             $this->tpl->parseCurrentBlock();
             break;
     }
     $this->tpl->setVariable('PANEL_TXT_CAL_NAME', $this->lng->txt('cal_calendar_name'));
     $this->tpl->setVariable('PANEL_CAL_NAME', $cat_info['title']);
     if ($cat_info['editable'] and !$a_app['event']->isAutoGenerated()) {
         $this->tpl->setCurrentBlock('panel_edit_link');
         $this->tpl->setVariable('TXT_PANEL_EDIT', $this->lng->txt('edit'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_EDIT_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askEdit'));
         $this->tpl->setCurrentBlock('panel_delete_link');
         $this->tpl->setVariable('TXT_PANEL_DELETE', $this->lng->txt('delete'));
         $this->ctrl->clearParametersByClass('ilcalendarappointmentgui');
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->getSeed()->get(IL_CAL_DATE));
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
         $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'dt', $a_app['dstart']);
         $this->tpl->setVariable('PANEL_DELETE_HREF', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'askdelete'));
         $this->tpl->parseCurrentBlock();
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
     if ($cat_info['type'] == ilCalendarCategory::TYPE_OBJ) {
         $refs = ilObject::_getAllReferences($entry_obj_id);
         $type = ilObject::_lookupType($entry_obj_id);
         $title = ilObject::_lookupTitle($entry_obj_id) ? ilObject::_lookupTitle($entry_obj_id) : $lng->txt('obj_' . $type);
         include_once './Services/Link/classes/class.ilLink.php';
         $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($entry_obj_id));
         $parent = $tree->getParentId(current($refs));
         $parent_title = ilObject::_lookupTitle(ilObject::_lookupObjId($parent));
         $this->tpl->setVariable('PANEL_TXT_LINK', $this->lng->txt('ext_link'));
         $this->tpl->setVariable('PANEL_LINK_HREF', $href);
         $this->tpl->setVariable('PANEL_LINK_NAME', $title);
         $this->tpl->setVariable('PANEL_PARENT', $parent_title);
     }
     return $this->tpl->get();
 }
 /**
  * show info screen
  *
  * @access protected
  * @return
  */
 protected function showInfoScreen()
 {
     global $tpl, $ilUser;
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->setFormAction($this->ctrl->getFormAction($this));
     if ($this->app->isMilestone()) {
         $info->addSection($this->lng->txt('cal_ms_details'));
     } else {
         $info->addSection($this->lng->txt('cal_details'));
     }
     // Appointment
     $info->addProperty($this->lng->txt('appointment'), ilDatePresentation::formatPeriod($this->app->getStart(), $this->app->getEnd()));
     $info->addProperty($this->lng->txt('title'), $this->app->getPresentationTitle());
     // Description
     if (strlen($desc = $this->app->getDescription())) {
         $info->addProperty($this->lng->txt('description'), $desc);
     }
     // Location
     if (strlen($loc = $this->app->getLocation())) {
         $info->addProperty($this->lng->txt('cal_where'), $loc);
     }
     // completion
     if ($this->app->isMilestone() && $this->app->getCompletion() > 0) {
         $info->addProperty($this->lng->txt('cal_task_completion'), $this->app->getCompletion() . " %");
     }
     include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
     $cat_id = ilCalendarCategoryAssignments::_lookupCategory($this->app->getEntryId());
     $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
     $type = ilObject::_lookupType($cat_info['obj_id']);
     if ($this->app->isMilestone() && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) {
         // users responsible
         $users = $this->app->readResponsibleUsers();
         $delim = "";
         foreach ($users as $r) {
             $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]";
             $delim = "<br />";
         }
         if (count($users) > 0) {
             $info->addProperty($this->lng->txt('cal_responsible'), $value);
         }
     }
     $category = new ilCalendarCategory($cat_id);
     if ($category->getType() == ilCalendarCategory::TYPE_OBJ) {
         $info->addSection($this->lng->txt('additional_info'));
         $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat_id);
         $refs = ilObject::_getAllReferences($cat_info['obj_id']);
         include_once './Services/Link/classes/class.ilLink.php';
         $href = ilLink::_getStaticLink(current($refs), ilObject::_lookupType($cat_info['obj_id']), true);
         $info->addProperty($this->lng->txt('perma_link'), '<a class="small" href="' . $href . '" target="_top">' . $href . '</a>');
     }
     $tpl->setContent($info->getHTML());
 }
 function mailRatersActionObject()
 {
     global $ilUser;
     $appr_id = $this->handleRatersAccess();
     $this->ctrl->setParameter($this, "appr_id", $appr_id);
     $rec_ids = explode(";", $_POST["rtr_id"]);
     if (!sizeof($rec_ids)) {
         $this->ctrl->redirect($this, "editRaters");
     }
     $form = $this->initMailRatersForm($appr_id, $rec_ids);
     if ($form->checkInput()) {
         $txt_u = $form->getInput("message_u");
         $txt_a = $form->getInput("message_a");
         $subj = $form->getInput("subject");
         // #12743
         $sender_id = trim($ilUser->getEmail()) ? $ilUser->getId() : ANONYMOUS_USER_ID;
         include_once "./Services/Mail/classes/class.ilMail.php";
         $all_data = $this->object->getRatersData($appr_id);
         foreach ($rec_ids as $rec_id) {
             if (isset($all_data[$rec_id])) {
                 $user = $all_data[$rec_id];
                 // anonymous
                 if (substr($rec_id, 0, 1) == "a") {
                     $mytxt = $txt_a;
                     $url = $user["href"];
                     $rcp = $user["email"];
                 } else {
                     $mytxt = $txt_u;
                     $user["code"] = $this->lng->txt("survey_code_mail_on_demand");
                     $url = ilLink::_getStaticLink($this->object->getRefId());
                     $rcp = $user["login"];
                     // #15141
                 }
                 $mytxt = str_replace("[lastname]", $user["lastname"], $mytxt);
                 $mytxt = str_replace("[firstname]", $user["firstname"], $mytxt);
                 $mytxt = str_replace("[url]", $url, $mytxt);
                 $mytxt = str_replace("[code]", $user["code"], $mytxt);
                 $mail = new ilMail($sender_id);
                 $mail->sendMail($rcp, "", "", $subj, $mytxt, array(), array('normal'));
                 $this->object->set360RaterSent($appr_id, substr($rec_id, 0, 1) == "a" ? 0 : (int) substr($rec_id, 1), substr($rec_id, 0, 1) == "u" ? 0 : (int) substr($rec_id, 1));
             }
         }
         ilUtil::sendSuccess($this->lng->txt("mail_sent"), true);
         $this->ctrl->redirect($this, "editRaters");
     }
     $form->setValuesByPost();
     $this->mailRatersObject($form);
 }
 /**
  * Send notification about team status
  * 
  * @param int $a_exc_ref_id
  * @param int $a_user_id
  * @param string $a_action
  */
 public function sendNotification($a_exc_ref_id, $a_user_id, $a_action)
 {
     global $ilUser;
     // no need to notify current user
     if ($ilUser->getId() == $a_user_id) {
         return;
     }
     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";
     include_once "./Services/Link/classes/class.ilLink.php";
     $link = ilLink::_getStaticLink($a_exc_ref_id);
     // use language of recipient to compose message
     $ulng = ilLanguageFactory::_getLanguageOfUser($a_user_id);
     $ulng->loadLanguageModule('exc');
     $subject = sprintf($ulng->txt('exc_team_notification_subject_' . $a_action), $this->getTitle());
     $message = sprintf($ulng->txt('exc_team_notification_salutation'), ilObjUser::_lookupFullname($a_user_id)) . "\n\n";
     $message .= $ulng->txt('exc_team_notification_body_' . $a_action) . "\n\n";
     $message .= $ulng->txt('obj_exc') . ": " . ilObject::_lookupTitle($this->getExerciseId()) . "\n";
     $message .= $ulng->txt('exc_assignment') . ": " . $this->getTitle() . "\n";
     $message .= $ulng->txt('exc_team_notification_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
     $message .= $ulng->txt('exc_team_notification_link') . ": " . $link;
     $mail_obj = new ilMail(ANONYMOUS_USER_ID);
     $mail_obj->appendInstallationSignature(true);
     $ret = $mail_obj->sendMail(ilObjUser::_lookupLogin($a_user_id), "", "", $subject, $message, array(), array("system"));
     // var_dump($ret);
 }
Exemplo n.º 22
0
 /**
  * Get current starting point setting as URL
  * 
  * @return string
  */
 public static function getStartingPointAsUrl()
 {
     global $tree, $ilUser;
     $ref_id = 1;
     if (self::hasPersonalStartingPoint()) {
         $current = self::getPersonalStartingPoint();
         if ($current == self::START_REPOSITORY_OBJ) {
             $ref_id = self::getPersonalStartingObject();
         }
     } else {
         $current = self::getStartingPoint();
         if ($current == self::START_REPOSITORY_OBJ) {
             $ref_id = self::getStartingObject();
         }
     }
     switch ($current) {
         case self::START_REPOSITORY:
         case self::START_REPOSITORY_OBJ:
             if ($ref_id && ilObject::_lookupObjId($ref_id) && !$tree->isDeleted($ref_id)) {
                 include_once './Services/Link/classes/class.ilLink.php';
                 return ilLink::_getStaticLink($ref_id, '', true);
             }
             // invalid starting object, overview is fallback
             $current = self::START_PD_OVERVIEW;
             // fallthrough
         // fallthrough
         default:
             $map = array(self::START_PD_OVERVIEW => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems', self::START_PD_SUBSCRIPTION => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships', self::START_PD_WORKSPACE => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace', self::START_PD_CALENDAR => 'ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToCalendar');
             return $map[$current];
     }
 }
Exemplo n.º 23
0
 /**
  * add standard object section
  */
 function addObjectSections()
 {
     global $lng, $ilCtrl, $ilUser, $ilAccess, $tree, $ilSetting, $ilObjDataCache;
     $this->addSection($lng->txt("additional_info"));
     $a_obj = $this->gui_object->object;
     // links to the object
     if (is_object($a_obj)) {
         // permanent link
         $type = $a_obj->getType();
         $ref_id = $a_obj->getRefId();
         if ($ref_id) {
             include_once './Services/Link/classes/class.ilLink.php';
             $href = ilLink::_getStaticLink($ref_id, $type, true);
             include_once 'Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
             if (ilECSServerSettings::getInstance()->activeServerExists()) {
                 $this->addProperty($lng->txt("object_id"), $a_obj->getId());
             }
             include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php';
             $pm = new ilPermanentLinkGUI($type, $ref_id);
             $pm->setIncludePermanentLinkText(false);
             $pm->setAlignCenter(false);
             $this->addProperty($lng->txt("perma_link"), $pm->getHTML(), "");
             // bookmarks
             $title = $ilObjDataCache->lookupTitle($a_obj->getId());
             $bms = ilPermanentLinkGUI::_getBookmarksSelectionList($title, $href);
             // links to resource
             if ($ilAccess->checkAccess("write", "", $ref_id) || $ilAccess->checkAccess("edit_permissions", "", $ref_id)) {
                 $obj_id = $a_obj->getId();
                 $rs = ilObject::_getAllReferences($obj_id);
                 $refs = array();
                 foreach ($rs as $r) {
                     if ($tree->isInTree($r)) {
                         $refs[] = $r;
                     }
                 }
                 if (count($refs) > 1) {
                     $links = $sep = "";
                     foreach ($refs as $r) {
                         $cont_loc = new ilLocatorGUI();
                         $cont_loc->addContextItems($r, true);
                         $links .= $sep . $cont_loc->getHTML();
                         $sep = "<br />";
                     }
                     $this->addProperty($lng->txt("res_links"), '<div class="small">' . $links . '</div>');
                 }
             }
         }
     }
     // creation date
     $this->addProperty($lng->txt("create_date"), ilDatePresentation::formatDate(new ilDateTime($a_obj->getCreateDate(), IL_CAL_DATETIME)));
     // owner
     if ($ilUser->getId() != ANONYMOUS_USER_ID and $a_obj->getOwner()) {
         include_once './Services/Object/classes/class.ilObjectFactory.php';
         include_once './Services/User/classes/class.ilObjUser.php';
         if (ilObjUser::userExists(array($a_obj->getOwner()))) {
             $ownerObj = ilObjectFactory::getInstanceByObjId($a_obj->getOwner(), false);
         } else {
             $ownerObj = ilObjectFactory::getInstanceByObjId(6, false);
         }
         if (!is_object($ownerObj) || $ownerObj->getType() != "usr") {
             $this->addProperty($lng->txt("owner"), $lng->txt("no_owner"));
         } else {
             if ($ownerObj->hasPublicProfile()) {
                 $ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user_id", $ownerObj->getId());
                 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName(), $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML"));
             } else {
                 $this->addProperty($lng->txt("owner"), $ownerObj->getPublicName());
             }
         }
     }
     // disk usage
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if ($ilUser->getId() != ANONYMOUS_USER_ID && ilDiskQuotaActivationChecker::_isActive()) {
         $size = $a_obj->getDiskUsage();
         if ($size !== null) {
             $this->addProperty($lng->txt("disk_usage"), ilFormat::formatSize($size, 'long'));
         }
     }
     // change event
     require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
     if (ilChangeEvent::_isActive()) {
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             $readEvents = ilChangeEvent::_lookupReadEvents($a_obj->getId());
             $count_users = 0;
             $count_members = 0;
             $count_user_reads = 0;
             $count_anonymous_reads = 0;
             foreach ($readEvents as $evt) {
                 if ($evt['usr_id'] == ANONYMOUS_USER_ID) {
                     $count_anonymous_reads += $evt['read_count'];
                 } else {
                     $count_user_reads += $evt['read_count'];
                     $count_users++;
                     /* to do: if ($evt['user_id'] is member of $this->getRefId())
                     			{
                     				$count_members++;
                     			}*/
                 }
             }
             if ($count_anonymous_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_anonymous_users"), $count_anonymous_reads);
             }
             if ($count_user_reads > 0) {
                 $this->addProperty($this->lng->txt("readcount_users"), $count_user_reads);
             }
             if ($count_users > 0) {
                 $this->addProperty($this->lng->txt("accesscount_registered_users"), $count_users);
             }
         }
     }
     // END ChangeEvent: Display change event info
     // BEGIN WebDAV: Display locking information
     require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
     if (ilDAVServer::_isActive()) {
         global $ilias, $ilUser;
         if ($ilUser->getId() != ANONYMOUS_USER_ID) {
             $davLocks = new ilDAVLocks();
             // Show lock info
             if ($ilias->account->getId() != ANONYMOUS_USER_ID) {
                 $locks =& $davLocks->getLocksOnObjectObj($a_obj->getId());
                 if (count($locks) > 0) {
                     $lockUser = new ilObjUser($locks[0]['ilias_owner']);
                     $this->addProperty($this->lng->txt("in_use_by"), $lockUser->getPublicName(), "./ilias.php?user=" . $locks[0]['ilias_owner'] . '&cmd=showUserProfile&cmdClass=ilpersonaldesktopgui&cmdNode=1&baseClass=ilPersonalDesktopGUI');
                 }
             }
         }
     }
     // END WebDAV: Display locking information
 }
Exemplo n.º 24
0
 /**
  * Last step of chat invitations
  * check access for every selected user and send invitation
  */
 public function submitInvitation()
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilCtrl ilCtrl
      * @var $lng    ilLanguage
      */
     global $ilUser, $ilCtrl, $lng;
     if (!$_POST['addr_ids']) {
         ilUtil::sendFailure($lng->txt('select_one'), true);
         $ilCtrl->redirect($this, 'showAddressbook');
     }
     if (!$_POST['room_id']) {
         ilUtil::sendFailure($lng->txt('select_one'));
         $_POST['addr_id'] = explode(',', $_POST['addr_ids']);
         $this->inviteToChat();
         return;
     }
     // get selected users (comma seperated user id list)
     $ids = explode(',', $_POST['addr_ids']);
     // get selected chatroom from POST-String, format: "room_id , scope"
     $room_ids = explode(',', $_POST['room_id']);
     $room_id = (int) $room_ids[0];
     $scope = 0;
     if (count($room_ids) > 0) {
         $scope = (int) $room_ids[1];
     }
     include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     $room = ilChatroom::byRoomId((int) $room_id, true);
     $no_access = array();
     $no_login = array();
     $valid_users = array();
     $valid_user_to_login_map = array();
     foreach ($ids as $id) {
         $entry = $this->abook->getEntry($id);
         if ($entry['login']) {
             $user_id = $ilUser->getUserIdByLogin($entry['login']);
             if (!$user_id) {
                 $no_login[] = $id;
                 continue;
             }
             $ref_id = $room->getRefIdByRoomId($room_id);
             if (!ilChatroom::checkPermissionsOfUser($user_id, 'read', $ref_id) || $room->isUserBanned($user_id)) {
                 $no_access[] = $id;
             } else {
                 $valid_users[] = $user_id;
                 $valid_user_to_login_map[$user_id] = $entry['login'];
             }
         } else {
             $no_login[] = $id;
         }
     }
     if (count($no_access) || count($no_login)) {
         $message = '';
         if (count($no_access)) {
             $message .= $lng->txt('chat_users_without_permission') . ':<br>';
             $list = '';
             foreach ($no_access as $e) {
                 $list .= '<li>' . $this->abook->entryToString($e) . '</li>';
             }
             $message .= '<ul>';
             $message .= $list;
             $message .= '</ul>';
         }
         if (count($no_login)) {
             $message .= $lng->txt('chat_users_without_login') . ':<br>';
             $list = '';
             foreach ($no_login as $e) {
                 $list .= '<li>' . $this->abook->entryToString($e) . '</li>';
             }
             $message .= '<ul>';
             $message .= $list;
             $message .= '</ul>';
         }
         ilUtil::sendFailure($message);
         $_POST['addr_id'] = $ids;
         $this->inviteToChat();
         return;
     }
     $ref_id = $room->getRefIdByRoomId($room_id);
     $url = '';
     include_once 'Services/Link/classes/class.ilLink.php';
     if ($scope) {
         $url = ilLink::_getStaticLink($ref_id, 'chta', true, '_' . $scope);
     } else {
         $url = ilLink::_getStaticLink($ref_id, 'chta');
     }
     $link = '<p><a target="chatframe" href="' . $url . '" title="' . $lng->txt('goto_invitation_chat') . '">' . $lng->txt('goto_invitation_chat') . '</a></p>';
     $userlist = array();
     foreach ($valid_users as $id) {
         $room->inviteUserToPrivateRoom($id, $scope);
         $room->sendInvitationNotification(null, $ilUser->getId(), $id, (int) $scope, $url);
         $userlist[] = '<li>' . $valid_user_to_login_map[$id] . '</li>';
     }
     if ($userlist) {
         ilUtil::sendSuccess($lng->txt('chat_users_have_been_invited') . '<ul>' . implode('', $userlist) . '</ul>' . $link, true);
     }
     $ilCtrl->redirect($this, 'showAddressbook');
 }
Exemplo n.º 25
0
 protected function sentReminder(array $a_recipient_ids)
 {
     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";
     include_once "./Services/Link/classes/class.ilLink.php";
     $link = ilLink::_getStaticLink($this->getRefId(), "svy");
     foreach ($a_recipient_ids as $user_id) {
         // use language of recipient to compose message
         $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
         $ulng->loadLanguageModule('survey');
         $subject = sprintf($ulng->txt('survey_reminder_subject'), $this->getTitle());
         $message = sprintf($ulng->txt('survey_reminder_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
         $message .= $ulng->txt('survey_reminder_body') . ":\n\n";
         $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
         $message .= "\n" . $ulng->txt('survey_reminder_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"));
     }
 }
 function callLink()
 {
     if ($_REQUEST["link_id"]) {
         $obj_id = $this->object->getId();
         include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
         $items = new ilLinkResourceItems($obj_id);
         $item = $items->getItem($_REQUEST["link_id"]);
         if ($item["target"]) {
             // handle internal links
             if (stristr($item["target"], "|")) {
                 $parts = explode("|", $item["target"]);
                 if ($parts[0] == "page") {
                     $parts[0] = "pg";
                 }
                 include_once "./Services/Link/classes/class.ilLink.php";
                 $item["target"] = ilLink::_getStaticLink($parts[1], $parts[0]);
                 if ($parts[0] == "term") {
                     $parts[0] = "git";
                     $item["target"] = ilLink::_getStaticLink(0, $parts[0], true, "&target=git_" . $parts[1]);
                 }
             }
             include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
             if (ilParameterAppender::_isEnabled()) {
                 $item = ilParameterAppender::_append($item);
             }
             //var_dump($item); exit;
             $this->redirectToLink($this->ref_id, $obj_id, $item["target"]);
         }
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $usage = $a_set;
     //var_dump($usage);
     if (is_int(strpos($usage["type"], ":"))) {
         $us_arr = explode(":", $usage["type"]);
         $usage["type"] = $us_arr[1];
         $cont_type = $us_arr[0];
     }
     //var_dump($usage);
     include_once './Services/Link/classes/class.ilLink.php';
     switch ($usage["type"]) {
         case "pg":
             include_once "./Services/COPage/classes/class.ilPageObjectFactory.php";
             $page_obj = ilPageObjectFactory::getInstance($cont_type, $usage["id"]);
             $item = array();
             //$this->tpl->setVariable("TXT_OBJECT", $usage["type"].":".$usage["id"]);
             switch ($cont_type) {
                 case "lm":
                     require_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
                     require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php";
                     require_once "./Modules/LearningModule/classes/class.ilLMObject.php";
                     $lm_obj = new ilObjLearningModule($page_obj->getParentId(), false);
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = $lm_obj->getTitle();
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilLMObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($lm_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($page_obj->getId() . "_" . $ref_id, "pg");
                     }
                     break;
                 case "wpg":
                     require_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                     $item["obj_type_txt"] = $this->lng->txt("obj_wiki");
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getParentId());
                     $item["sub_txt"] = $this->lng->txt("pg");
                     $item["sub_title"] = ilWikiPage::lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "wiki");
                     }
                     break;
                 case "gdf":
                     require_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
                     require_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
                     $term_id = ilGlossaryDefinition::_lookupTermId($page_obj->getId());
                     $glo_id = ilGlossaryTerm::_lookGlossaryId($term_id);
                     $item["obj_type_txt"] = $this->lng->txt("obj_glo");
                     $item["obj_title"] = ilObject::_lookupTitle($glo_id);
                     $item["sub_txt"] = $this->lng->txt("cont_term");
                     $item["sub_title"] = ilGlossaryTerm::_lookGlossaryTerm($term_id);
                     $ref_id = $this->getFirstWritableRefId($page_obj->getParentId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, "glo");
                     }
                     break;
                 case "cont":
                     $item["obj_type_txt"] = $this->lng->txt("obj_" . $cont_type);
                     $item["obj_title"] = ilObject::_lookupTitle($page_obj->getId());
                     $ref_id = $this->getFirstWritableRefId($page_obj->getId());
                     if ($ref_id > 0) {
                         $item["obj_link"] = ilLink::_getStaticLink($ref_id, $cont_type);
                     }
                     break;
             }
             break;
         case "mep":
             $item["obj_type_txt"] = $this->lng->txt("obj_mep");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $ref_id = $this->getFirstWritableRefId($usage["id"]);
             if ($ref_id > 0) {
                 $item["obj_link"] = ilLink::_getStaticLink($ref_id, "mep");
             }
             break;
         case "map":
             $item["obj_type_txt"] = $this->lng->txt("obj_mob");
             $item["obj_title"] = ilObject::_lookupTitle($usage["id"]);
             $item["sub_txt"] = $this->lng->txt("cont_link_area");
             break;
     }
     // show versions
     if (is_array($usage["hist_nr"]) && (count($usage["hist_nr"]) > 1 || $usage["hist_nr"][0] > 0)) {
         asort($usage["hist_nr"]);
         $ver = $sep = "";
         if ($usage["hist_nr"][0] == 0) {
             array_shift($usage["hist_nr"]);
             $usage["hist_nr"][] = 0;
         }
         if (count($usage["hist_nr"]) > 5) {
             $ver .= "..., ";
             $cnt = count($usage["hist_nr"]) - 5;
             for ($i = 0; $i < $cnt; $i++) {
                 unset($usage["hist_nr"][$i]);
             }
         }
         foreach ($usage["hist_nr"] as $nr) {
             if ($nr > 0) {
                 $ver .= $sep . $nr;
             } else {
                 $ver .= $sep . $this->lng->txt("cont_current_version");
             }
             $sep = ", ";
         }
         $this->tpl->setCurrentBlock("versions");
         $this->tpl->setVariable("TXT_VERSIONS", $this->lng->txt("cont_versions"));
         $this->tpl->setVariable("VAL_VERSIONS", $ver);
         $this->tpl->parseCurrentBlock();
     }
     if ($item["obj_type_txt"] != "") {
         $this->tpl->setCurrentBlock("type");
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("type"));
         $this->tpl->setVariable("VAL_TYPE", $item["obj_type_txt"]);
         $this->tpl->parseCurrentBlock();
     }
     if ($usage["type"] != "clip") {
         if ($item["obj_link"]) {
             $this->tpl->setCurrentBlock("linked_item");
             $this->tpl->setVariable("TXT_OBJECT", $item["obj_title"]);
             $this->tpl->setVariable("HREF_LINK", $item["obj_link"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $item["obj_title"]);
         }
         if ($item["sub_txt"] != "") {
             $this->tpl->setVariable("SEP", ", ");
             $this->tpl->setVariable("SUB_TXT", $item["sub_txt"]);
             if ($item["sub_title"] != "") {
                 $this->tpl->setVariable("SEP2", ": ");
                 $this->tpl->setVariable("SUB_TITLE", $item["sub_title"]);
             }
         }
     } else {
         $this->tpl->setVariable("TXT_OBJECT_NO_LINK", $this->lng->txt("cont_users_have_mob_in_clip1") . " " . $usage["cnt"] . " " . $this->lng->txt("cont_users_have_mob_in_clip2"));
     }
 }
 /**
  * note: most of this stuff is used by ilCourseContentInterface too
  */
 function buildLinkTarget($a_node_id, $a_type)
 {
     global $ilCtrl;
     switch ($a_type) {
         case "cat":
             return "ilias.php?baseClass=ilshopcontroller&ref_id=" . $a_node_id;
         case "catr":
             return "ilias.php?cmd=redirect&baseClass=ilshopcontroller&ref_id=" . $a_node_id;
         case "grp":
             return "ilias.php?baseClass=ilshopcontroller&ref_id=" . $a_node_id;
         case "crs":
             return "ilias.php?baseClass=ilshopcontroller&ref_id=" . $a_node_id;
         case "crsr":
             return "ilias.php?cmd=redirect&baseClass=ilshopcontroller&ref_id=" . $a_node_id;
         case "icrs":
             $ilCtrl->setParameterByClass("ilobjilinccoursegui", "ref_id", $a_node_id);
             $link = $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", "ilobjilinccoursegui"), "");
             $ilCtrl->setParameterByClass("ilobjilinccoursegui", "ref_id", $_GET["ref_id"]);
             return $link;
         case 'rcrs':
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $a_node_id);
             $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
             $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
             return $link;
         default:
             include_once './Services/Link/classes/class.ilLink.php';
             return ilLink::_getStaticLink($a_node_id, $a_type, true);
     }
 }
 /**
  * Get overview.
  */
 function getIntroduction()
 {
     global $ilUser, $lng, $ilCtrl, $tree;
     switch ((int) $this->view) {
         case self::VIEW_MY_MEMBERSHIPS:
             $tpl = new ilTemplate('tpl.pd_my_memberships_intro.html', true, true, 'Services/PersonalDesktop');
             $tpl->setVariable('IMG_PD_LARGE', ilUtil::getImagePath('icon_pd_xxl.png'));
             $tpl->setVariable('TXT_WELCOME', $lng->txt('pd_my_memberships_intro'));
             $tpl->setVariable('TXT_INTRO_1', $lng->txt('pd_my_memberships_intro2'));
             break;
         case self::VIEW_MY_OFFERS:
         default:
             // get repository link
             $nd = $tree->getNodeData(ROOT_FOLDER_ID);
             $title = $nd["title"];
             if ($title == "ILIAS") {
                 $title = $lng->txt("repository");
             }
             $tpl = new ilTemplate("tpl.pd_intro.html", true, true, "Services/PersonalDesktop");
             $tpl->setVariable("IMG_PD_LARGE", ilUtil::getImagePath("icon_pd_xxl.png"));
             $tpl->setVariable("TXT_WELCOME", $lng->txt("pdesk_intro"));
             $tpl->setVariable("TXT_INTRO_1", sprintf($lng->txt("pdesk_intro2"), $lng->txt("to_desktop")));
             include_once "./Services/Link/classes/class.ilLink.php";
             $tpl->setVariable("TXT_INTRO_2", sprintf($lng->txt("pdesk_intro3"), '<a href="' . ilLink::_getStaticLink(1, 'root', true) . '">' . $title . '</a>'));
             $tpl->setVariable("TXT_INTRO_3", $lng->txt("pdesk_intro4"));
             break;
     }
     return $tpl->get();
 }
Exemplo n.º 30
0
 /**
  * add ILIAS footer
  */
 function addILIASFooter()
 {
     global $ilAuth;
     if (!$this->getAddFooter()) {
         return;
     }
     global $ilias, $ilClientIniFile, $ilCtrl, $ilDB, $ilSetting, $lng;
     $ftpl = new ilTemplate("tpl.footer.html", true, true, "Services/UICore");
     $ftpl->setVariable("ILIAS_VERSION", $ilias->getSetting("ilias_version"));
     $link_items = array();
     // imprint
     include_once "Services/Imprint/classes/class.ilImprint.php";
     if ($_REQUEST["baseClass"] != "ilImprintGUI" && ilImprint::isActive()) {
         include_once "Services/Link/classes/class.ilLink.php";
         $link_items[ilLink::_getStaticLink(0, "impr")] = array($lng->txt("imprint"), true);
     }
     $link_items["mailto:" . ilUtil::prepareFormOutput($ilSetting->get("feedback_recipient"))] = array($lng->txt("contact_sysadmin"), false);
     if (DEVMODE && version_compare(PHP_VERSION, '5', '>=')) {
         $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=xhtml")] = array("Validate", true);
         $link_items[ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=accessibility")] = array("Accessibility", true);
     }
     // output translation link (extended language maintenance)
     if ($ilSetting->get("lang_ext_maintenance") == "1") {
         include_once "Services/Language/classes/class.ilObjLanguageAccess.php";
         if (ilObjLanguageAccess::_checkTranslate() and !ilObjLanguageAccess::_isPageTranslation()) {
             ilObjLanguageAccess::_saveUsages();
             $link_items[ilObjLanguageAccess::_getTranslationLink()] = array($lng->txt('translation'), true);
         }
     }
     $cnt = 0;
     foreach ($link_items as $url => $caption) {
         $cnt++;
         if ($caption[1]) {
             $ftpl->touchBlock("blank");
         }
         if ($cnt < sizeof($link_items)) {
             $ftpl->touchBlock("item_separator");
         }
         $ftpl->setCurrentBlock("items");
         $ftpl->setVariable("URL_ITEM", $url);
         $ftpl->setVariable("TXT_ITEM", $caption[0]);
         $ftpl->parseCurrentBlock();
     }
     if (DEVMODE) {
         // execution time
         $t1 = explode(" ", $GLOBALS['ilGlobalStartTime']);
         $t2 = explode(" ", microtime());
         $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1];
         $mem_usage = array();
         if (function_exists("memory_get_usage")) {
             $mem_usage[] = "Memory Usage: " . memory_get_usage() . " Bytes";
         }
         if (function_exists("xdebug_peak_memory_usage")) {
             $mem_usage[] = "XDebug Peak Memory Usage: " . xdebug_peak_memory_usage() . " Bytes";
         }
         $mem_usage[] = round($diff, 4) . " Seconds";
         if (sizeof($mem_usage)) {
             $ftpl->setVariable("MEMORY_USAGE", "<br>" . implode(" | ", $mem_usage));
         }
         if (is_object($ilAuth) && isset($_SESSION[$ilAuth->_sessionName]) && isset($_SESSION[$ilAuth->_sessionName]["timestamp"])) {
             $ftpl->setVariable("SESS_INFO", "<br />maxlifetime: " . ini_get("session.gc_maxlifetime") . " (" . ini_get("session.gc_maxlifetime") / 60 . "), id: " . session_id() . "<br />" . "timestamp: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["timestamp"]) . ", idle: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"]) . "<br />expire: " . ($exp = $ilClientIniFile->readVariable("session", "expire")) . " (" . $exp / 60 . "), session ends at: " . date("Y-m-d H:i:s", $_SESSION[$ilAuth->_sessionName]["idle"] + $exp));
         }
         if (!empty($_GET["do_dev_validate"]) && $ftpl->blockExists("xhtml_validation")) {
             require_once "Services/XHTMLValidator/classes/class.ilValidatorAdapter.php";
             $template2 = clone $this;
             //echo "-".ilValidatorAdapter::validate($template2->get(), $_GET["do_dev_validate"])."-";
             $ftpl->setCurrentBlock("xhtml_validation");
             $ftpl->setVariable("VALIDATION", ilValidatorAdapter::validate($template2->get("DEFAULT", false, false, false, true), $_GET["do_dev_validate"]));
             $ftpl->parseCurrentBlock();
         }
         // controller history
         if (is_object($ilCtrl) && $ftpl->blockExists("c_entry") && $ftpl->blockExists("call_history")) {
             $hist = $ilCtrl->getCallHistory();
             foreach ($hist as $entry) {
                 $ftpl->setCurrentBlock("c_entry");
                 $ftpl->setVariable("C_ENTRY", $entry["class"]);
                 if (is_object($ilDB)) {
                     $file = $ilCtrl->lookupClassPath($entry["class"]);
                     $add = $entry["mode"] . " - " . $entry["cmd"];
                     if ($file != "") {
                         $add .= " - " . $file;
                     }
                     $ftpl->setVariable("C_FILE", $add);
                 }
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("call_history");
             $ftpl->parseCurrentBlock();
             // debug hack
             $debug = $ilCtrl->getDebug();
             foreach ($debug as $d) {
                 $ftpl->setCurrentBlock("c_entry");
                 $ftpl->setVariable("C_ENTRY", $d);
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("call_history");
             $ftpl->parseCurrentBlock();
         }
         // included files
         if (is_object($ilCtrl) && $ftpl->blockExists("i_entry") && $ftpl->blockExists("included_files")) {
             $fs = get_included_files();
             $ifiles = array();
             $total = 0;
             foreach ($fs as $f) {
                 $ifiles[] = array("file" => $f, "size" => filesize($f));
                 $total += filesize($f);
             }
             $ifiles = ilUtil::sortArray($ifiles, "size", "desc", true);
             foreach ($ifiles as $f) {
                 $ftpl->setCurrentBlock("i_entry");
                 $ftpl->setVariable("I_ENTRY", $f["file"] . " (" . $f["size"] . " Bytes, " . round(100 / $total * $f["size"], 2) . "%)");
                 $ftpl->parseCurrentBlock();
             }
             $ftpl->setCurrentBlock("i_entry");
             $ftpl->setVariable("I_ENTRY", "Total (" . $total . " Bytes, 100%)");
             $ftpl->parseCurrentBlock();
             $ftpl->setCurrentBlock("included_files");
             $ftpl->parseCurrentBlock();
         }
     }
     // BEGIN Usability: Non-Delos Skins can display the elapsed time in the footer
     // The corresponding $ilBench->start invocation is in inc.header.php
     global $ilBench;
     $ilBench->stop("Core", "ElapsedTimeUntilFooter");
     $ftpl->setVariable("ELAPSED_TIME", ", " . number_format($ilBench->getMeasuredTime("Core", "ElapsedTimeUntilFooter"), 1) . ' seconds');
     // END Usability: Non-Delos Skins can display the elapsed time in the footer
     $this->setVariable("FOOTER", $ftpl->get());
 }