Exemplo n.º 1
0
 public function showCalendarSubscription()
 {
     global $lng, $ilUser;
     $tpl = new ilTemplate('tpl.show_calendar_subscription.html', true, true, 'Services/Calendar');
     $tpl->setVariable('TXT_TITLE', $lng->txt('cal_subscription_header'));
     $tpl->setVariable('TXT_INFO', $lng->txt('cal_subscription_info'));
     $tpl->setVariable('TXT_CAL_URL', $lng->txt('cal_subscription_url'));
     include_once './Services/Calendar/classes/class.ilCalendarAuthenticationToken.php';
     switch ($this->mode) {
         case ilCalendarCategories::MODE_PERSONAL_DESKTOP_ITEMS:
         case ilCalendarCategories::MODE_PERSONAL_DESKTOP_MEMBERSHIP:
             $selection = ilCalendarAuthenticationToken::SELECTION_PD;
             $calendar = 0;
             break;
         default:
             $selection = ilCalendarAuthenticationToken::SELECTION_CATEGORY;
             // TODO: calendar id
             $calendar = ilObject::_lookupObjId((int) $_GET['ref_id']);
             break;
     }
     if ($hash = ilCalendarAuthenticationToken::lookupAuthToken($ilUser->getId(), $selection, $calendar)) {
     } else {
         $token = new ilCalendarAuthenticationToken($ilUser->getId());
         $token->setSelectionType($selection);
         $token->setCalendar($calendar);
         $hash = $token->add();
     }
     $url = ILIAS_HTTP_PATH . '/calendar.php?client_id=' . CLIENT_ID . '&token=' . $hash;
     $tpl->setVariable('VAL_CAL_URL', $url);
     $tpl->setVariable('VAL_CAL_URL_TXT', $url);
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     $content_block->setTitle($lng->txt("calendar"));
     $content_block->addHeaderCommand($this->ctrl->getParentReturn($this), $lng->txt("selected_items_back"));
     return $content_block->getHTML();
 }
 /**
  * Show feed URL.
  */
 function showFeedUrl()
 {
     global $lng, $ilCtrl, $ilUser;
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $title = ilObject::_lookupTitle($this->block_id);
     $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
     $tpl->setVariable("TXT_TITLE", sprintf($lng->txt("news_feed_url_for"), $title));
     $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
     $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
     $tpl->setVariable("VAL_FEED_URL", ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() . "&obj_id=" . $this->block_id . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
     $tpl->setVariable("VAL_FEED_URL_TXT", ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() . "&obj_id=" . $this->block_id . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     $content_block->setTitle($lng->txt("news_internal_news"));
     $content_block->setImage(ilUtil::getImagePath("icon_news.png"));
     $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), $lng->txt("close"), true);
     return $content_block->getHTML();
 }
 /**
  * show mail
  */
 protected function showMail()
 {
     global $lng, $ilCtrl;
     include_once "./Services/Mail/classes/class.ilPDMailGUI.php";
     $mail_gui = new ilPDMailGUI();
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($mail_gui->getPDMailHTML($_GET["mail_id"], $_GET["mobj_id"]));
     $content_block->setTitle($lng->txt("message"));
     $content_block->setColSpan(2);
     $content_block->setImage(ilUtil::getImagePath("icon_mail.png"));
     $content_block->addHeaderCommand($ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"), $lng->txt("selected_items_back"));
     if ($_GET["mail_mode"] != "system") {
         $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=" . $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=reply", $lng->txt("reply"));
         $content_block->addBlockCommand("ilias.php?baseClass=ilMailGUI&mail_id=" . $_GET["mail_id"] . "&mobj_id=" . $_GET["mobj_id"] . "&type=read", $lng->txt("inbox"));
         $ilCtrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
         $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, 'deleteMail'), $lng->txt('delete'));
     } else {
         $ilCtrl->setParameter($this, "mail_id", $_GET["mail_id"]);
         $ilCtrl->setParameter($this, "mobj_id", $_GET["mobj_id"]);
         $content_block->addBlockCommand($ilCtrl->getLinkTarget($this, "deleteMail"), $lng->txt("delete"));
         $ilCtrl->clearParameters($this);
     }
     return $content_block->getHTML();
 }
 protected function filterContainer()
 {
     global $objDefinition, $lng, $tree, $ilAccess, $ilCtrl;
     $this->initProviders();
     // empty selection is invalid
     if (!$_SESSION[self::getBlockType()]) {
         exit;
     }
     $all_matching_provider_object_ids = null;
     foreach ($this->providers as $provider) {
         $id = get_class($provider);
         $current = $_SESSION[self::getBlockType()][$id];
         if ($current) {
             // combine providers AND
             $provider_object_ids = $provider->getFilteredObjects();
             if (is_array($all_matching_provider_object_ids)) {
                 $all_matching_provider_object_ids = array_intersect($matching_provider_object_ids, $provider_object_ids);
             } else {
                 $all_matching_provider_object_ids = $provider_object_ids;
             }
         }
     }
     $has_content = false;
     $ltpl = new ilTemplate("tpl.classification_object_list.html", true, true, "Services/Classification");
     if (sizeof($all_matching_provider_object_ids)) {
         $fields = array("object_reference.ref_id", "object_data.obj_id", "object_data.type", "object_data.title", "object_data.description");
         $matching = $tree->getSubTreeFilteredByObjIds($this->parent_ref_id, $all_matching_provider_object_ids, $fields);
         if (sizeof($matching)) {
             $valid_objects = array();
             // :TODO: not sure if this makes sense...
             include_once "Services/Object/classes/class.ilObjectListGUIPreloader.php";
             $preloader = new ilObjectListGUIPreloader(ilObjectListGUI::CONTEXT_REPOSITORY);
             foreach ($matching as $item) {
                 if ($item["ref_id"] != $this->parent_ref_id && !$tree->isDeleted($item["ref_id"]) && $ilAccess->checkAccess("read", "", $item["ref_id"])) {
                     $valid_objects[] = $item;
                     $preloader->addItem($item["obj_id"], $item["type"], $item["ref_id"]);
                 }
             }
             if (sizeof($valid_objects)) {
                 $has_content = true;
                 $preloader->preload();
                 // see ilPDTaggingBlockGUI::showResourcesForTag()
                 $this->item_list_gui = array();
                 foreach ($valid_objects as $obj) {
                     $type = $obj["type"];
                     // get list gui class for each object type
                     if (empty($this->item_list_gui[$type])) {
                         $class = $objDefinition->getClassName($type);
                         $location = $objDefinition->getLocation($type);
                         $full_class = "ilObj" . $class . "ListGUI";
                         include_once $location . "/class." . $full_class . ".php";
                         $this->item_list_gui[$type] = new $full_class();
                         $this->item_list_gui[$type]->enableDelete(false);
                         $this->item_list_gui[$type]->enablePath(true, $this->parent_ref_id);
                         // relative path
                         $this->item_list_gui[$type]->enableCut(false);
                         $this->item_list_gui[$type]->enableCopy(false);
                         $this->item_list_gui[$type]->enableSubscribe(false);
                         $this->item_list_gui[$type]->enablePayment(false);
                         $this->item_list_gui[$type]->enableLink(false);
                         $this->item_list_gui[$type]->enableIcon(true);
                         // :TOOD: for each item or just for each list?
                         foreach ($this->providers as $provider) {
                             $provider->initListGUI($this->item_list_gui[$type]);
                         }
                     }
                     $html = $this->item_list_gui[$type]->getListItemHTML($obj["ref_id"], $obj["obj_id"], $obj["title"], $obj["description"]);
                     if ($html != "") {
                         $css = $css != "tblrow1" ? "tblrow1" : "tblrow2";
                         $ltpl->setCurrentBlock("res_row");
                         $ltpl->setVariable("ROWCLASS", $css);
                         $ltpl->setVariable("RESOURCE_HTML", $html);
                         $ltpl->setVariable("ALT_TYPE", $lng->txt("obj_" . $type));
                         $ltpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_" . $type . ".svg"));
                         $ltpl->parseCurrentBlock();
                     }
                 }
             }
         }
     }
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setTitle($lng->txt("clsfct_content_title"));
     $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), "", true);
     if ($has_content) {
         $content_block->setContent($ltpl->get());
     } else {
         $content_block->setContent($lng->txt("clsfct_content_no_match"));
     }
     echo $content_block->getHTML();
     exit;
 }
 /**
  * Show Feed Item
  */
 function showFeedItem()
 {
     global $lng, $ilCtrl;
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $this->feed->fetch();
     foreach ($this->feed->getItems() as $item) {
         if ($item->getId() == $_GET["feed_item_id"]) {
             $c_item = $item;
             break;
         }
     }
     $tpl = new ilTemplate("tpl.show_feed_item.html", true, true, "Services/Feeds");
     if (is_object($c_item)) {
         if (trim($c_item->getSummary()) != "") {
             $tpl->setCurrentBlock("content");
             $tpl->setVariable("VAL_CONTENT", $c_item->getSummary());
             $tpl->parseCurrentBlock();
         }
         if (trim($c_item->getDate()) != "" || trim($c_item->getAuthor()) != "") {
             $tpl->setCurrentBlock("date_author");
             if (trim($c_item->getAuthor()) != "") {
                 $tpl->setVariable("VAL_AUTHOR", $c_item->getAuthor() . " - ");
             }
             $tpl->setVariable("VAL_DATE", $c_item->getDate());
             $tpl->parseCurrentBlock();
         }
         if (trim($c_item->getLink()) != "") {
             $tpl->setCurrentBlock("plink");
             $tpl->setVariable("HREF_LINK", $c_item->getLink());
             $tpl->setVariable("TXT_LINK", $lng->txt("feed_open_source_page"));
             $tpl->parseCurrentBlock();
         }
         $tpl->setVariable("VAL_TITLE", $c_item->getTitle());
         // title
     }
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     $content_block->setTitle($this->getTitle());
     $content_block->setImage(ilUtil::getImagePath("icon_feed.png"));
     $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), $lng->txt("close"), true);
     return $content_block->getHTML();
 }
 /**
  * show single note
  */
 function showNote()
 {
     global $lng, $ilCtrl;
     include_once "./Services/Notes/classes/class.ilNoteGUI.php";
     $note_gui = new ilNoteGUI();
     $note_gui->enableTargets();
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($note_gui->getPDNoteHTML($_GET["note_id"]));
     $content_block->setTitle($lng->txt("note"));
     $content_block->setColSpan(2);
     $content_block->setImage(ilUtil::getImagePath("icon_note.png"));
     $content_block->addHeaderCommand($ilCtrl->getLinkTargetByClass("ilpersonaldesktopgui", "show"), $lng->txt("selected_items_back"));
     return $content_block->getHTML();
 }
 /**
  * List resources for tag
  */
 function showResourcesForTag()
 {
     global $lng, $ilCtrl, $ilUser, $objDefinition;
     $_GET["tag"] = str_replace("-->", "", $_GET["tag"]);
     $tpl = new ilTemplate("tpl.resources_for_tag.html", true, true, "Services/Tagging");
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setColSpan(2);
     $content_block->setTitle(sprintf($lng->txt("tagging_resources_for_tag"), "<i>" . $_GET["tag"] . "</i>"));
     $content_block->setImage(ilUtil::getImagePath("icon_tag.svg"));
     $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), $lng->txt("selected_items_back"));
     // get resources
     include_once "./Services/Tagging/classes/class.ilTagging.php";
     $objs = ilTagging::getObjectsForTagAndUser($ilUser->getId(), $_GET["tag"]);
     $unaccessible = false;
     foreach ($objs as $key => $obj) {
         $ref_ids = ilObject::_getAllReferences($obj["obj_id"]);
         foreach ($ref_ids as $ref_id) {
             $type = $obj["obj_type"];
             if ($type == "") {
                 $unaccessible = true;
                 continue;
             }
             // get list gui class for each object type
             if (empty($this->item_list_gui[$type])) {
                 $class = $objDefinition->getClassName($type);
                 $location = $objDefinition->getLocation($type);
                 $full_class = "ilObj" . $class . "ListGUI";
                 include_once $location . "/class." . $full_class . ".php";
                 $this->item_list_gui[$type] = new $full_class();
                 $this->item_list_gui[$type]->enableDelete(false);
                 $this->item_list_gui[$type]->enablePath(true);
                 $this->item_list_gui[$type]->enableCut(false);
                 $this->item_list_gui[$type]->enableCopy(false);
                 $this->item_list_gui[$type]->enableSubscribe(false);
                 $this->item_list_gui[$type]->enablePayment(false);
                 $this->item_list_gui[$type]->enableLink(false);
                 $this->item_list_gui[$type]->enableIcon(true);
             }
             $html = $this->item_list_gui[$type]->getListItemHTML($ref_id, $obj["obj_id"], ilObject::_lookupTitle($obj["obj_id"]), ilObject::_lookupDescription($obj["obj_id"]));
             if ($html != "") {
                 $css = $css != "tblrow1" ? "tblrow1" : "tblrow2";
                 $tpl->setCurrentBlock("res_row");
                 $tpl->setVariable("ROWCLASS", $css);
                 $tpl->setVariable("RESOURCE_HTML", $html);
                 $tpl->setVariable("ALT_TYPE", $lng->txt("obj_" . $type));
                 $tpl->setVariable("IMG_TYPE", ilUtil::getImagePath("icon_" . $type . ".svg"));
                 $tpl->parseCurrentBlock();
             } else {
                 $unaccessible = true;
             }
         }
     }
     if ($unaccessible) {
         $tpl->setCurrentBlock("no_access");
         $tpl->setVariable("SOME_OBJ_WITHOUT_ACCESS", $lng->txt("tag_some_obj_tagged_without_access"));
         $ilCtrl->saveParameter($this, "tag");
         $tpl->setVariable("HREF_REMOVE_TAGS", $ilCtrl->getLinkTarget($this, "removeTagsWithoutAccess"));
         $tpl->setVariable("REMOVE_TAGS", $lng->txt("tag_remove_tags_of_obj_without_access"));
         $tpl->parseCurrentBlock();
     }
     $content_block->setContent($tpl->get());
     //$content_block->setContent("test");
     return $content_block->getHTML();
 }
Exemplo n.º 8
0
 /**
  * Show feed URL.
  */
 function showFeedUrl()
 {
     global $lng, $ilCtrl, $ilUser, $ilSetting;
     $news_set = new ilSetting("news");
     include_once "./Services/News/classes/class.ilNewsItem.php";
     if ($news_set->get("enable_private_feed")) {
         $tpl = new ilTemplate("tpl.show_priv_feed_url.html", true, true, "Services/News");
         $tpl->setVariable("TXT_PRIV_TITLE", $lng->txt("news_get_priv_feed_title"));
         // #14365
         if ($ilUser->_getFeedPass($_SESSION["AccountId"])) {
             $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_get_priv_feed_info"));
             $tpl->setVariable("TXT_PRIV_FEED_URL", $lng->txt("news_feed_url"));
             $tpl->setVariable("VAL_PRIV_FEED_URL", str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
             $tpl->setVariable("VAL_PRIV_FEED_URL_TXT", str_replace("://", "://" . $ilUser->getLogin() . ":-password-@", ILIAS_HTTP_PATH) . "/privfeed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
         } else {
             $tpl->setVariable("TXT_PRIV_INFO", $lng->txt("news_inactive_private_feed_info"));
             $tpl->setVariable("EDIT_SETTINGS_URL", $ilCtrl->getLinkTarget($this, "editSettings"));
             $tpl->setVariable("EDIT_SETTINGS_TXT", $lng->txt("news_edit_news_settings"));
         }
     } else {
         $tpl = new ilTemplate("tpl.show_feed_url.html", true, true, "Services/News");
     }
     $tpl->setVariable("TXT_TITLE", $lng->txt("news_get_feed_title"));
     $tpl->setVariable("TXT_INFO", $lng->txt("news_get_feed_info"));
     $tpl->setVariable("TXT_FEED_URL", $lng->txt("news_feed_url"));
     $tpl->setVariable("VAL_FEED_URL", ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&user_id=" . $ilUser->getId() . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
     $tpl->setVariable("VAL_FEED_URL_TXT", ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&<br />user_id=" . $ilUser->getId() . "&hash=" . ilObjUser::_lookupFeedHash($ilUser->getId(), true));
     include_once "./Services/PersonalDesktop/classes/class.ilPDContentBlockGUI.php";
     $content_block = new ilPDContentBlockGUI();
     $content_block->setContent($tpl->get());
     $content_block->setTitle($lng->txt("news_internal_news"));
     $content_block->addHeaderCommand($ilCtrl->getParentReturn($this), $lng->txt("selected_items_back"));
     return $content_block->getHTML();
 }