/** * called by prepare output */ protected function setTitleAndDescription() { if (!is_object($this->object)) { if ((int) $_REQUEST["crtptrefid"] > 0) { $cr_obj_id = ilObject::_lookupObjId((int) $_REQUEST["crtcb"]); $this->tpl->setTitle(ilObject::_lookupTitle($cr_obj_id)); $this->tpl->setTitleIcon(ilObject::_getIcon($cr_obj_id)); } return; } $this->tpl->setTitle($this->object->getPresentationTitle()); $this->tpl->setDescription($this->object->getLongDescription()); if (strtolower($_GET["baseClass"]) == "iladministrationgui") { // alt text would be same as heading -> empty alt text $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType())); } else { $this->tpl->setTitleIcon(ilObject::_getIcon("", "big", $this->object->getType()), $this->lng->txt("obj_" . $this->object->getType())); } include_once './Services/Object/classes/class.ilObjectListGUIFactory.php'; $lgui = ilObjectListGUIFactory::_getListGUIByType($this->object->getType()); $lgui->initItem($this->object->getRefId(), $this->object->getId()); $this->tpl->setAlertProperties($lgui->getAlertProperties()); }
/** * Get ListGUI object for item */ protected function getItemGUI($item_data, $a_show_path = false) { include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php'; // get item list gui object if (!is_object($this->list_gui[$item_data["type"]])) { $item_list_gui =& ilObjectListGUIFactory::_getListGUIByType($item_data["type"]); $item_list_gui->setContainerObject($this->getContainerGUI()); $this->list_gui[$item_data["type"]] =& $item_list_gui; } else { $item_list_gui =& $this->list_gui[$item_data["type"]]; } // unique js-ids $item_list_gui->setParentRefId($item_data["parent"]); $item_list_gui->setDefaultCommandParameters(array()); $item_list_gui->disableTitleLink(false); $item_list_gui->resetConditionTarget(); // show administration command buttons (or not) if (!$this->getContainerGUI()->isActiveAdministrationPanel()) { // $item_list_gui->enableDelete(false); // $item_list_gui->enableLink(false); // $item_list_gui->enableCut(false); } // activate common social commands $item_list_gui->enableComments(true); $item_list_gui->enableNotes(true); $item_list_gui->enableTags(true); $item_list_gui->enableRating(true); // container specific modifications $this->getContainerGUI()->modifyItemGUI($item_list_gui, $item_data, $a_show_path); return $item_list_gui; }
/** * @param $cur_obj_type * @param $item * @return array */ private function getObjectListItem($cur_obj_type, $item) { if ($cur_obj_type != $item['type']) { include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php'; $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item['type']); } $item_list_gui->initItem($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], ilObjectListGUI::CONTEXT_SHOP); $item_list_gui->enableDelete(false); $item_list_gui->enableCut(false); $item_list_gui->enableCopy(false); $item_list_gui->enableLink(false); $item_list_gui->enableSubscribe(false); $item_list_gui->enablePayment(true); $item_list_gui->enableCommands(true); $item_list_gui->enablePath(false); $item_list_gui->insertCommands(); $item_list_gui->enableInfoScreen(false); $item_list_gui->enableSubstitutions(false); $item_list_gui->enableNoticeProperties(false); $item_list_gui->enablePreconditions(false); $item_list_gui->enableProperties(false); $item_list_gui->setBoldTitle(true); if (ilPaymentObject::_hasAccess($item['ref_id'])) { $item_list_gui->enableInfoScreen(true); $item_list_gui->enableCommands(true); } // else // { switch ($item['type']) { case 'sahs': $demo_link = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo'; break; case 'lm': $demo_link = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo'; break; case 'exc': $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"]; break; default: $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"]; break; } $item['title'] = '<a href="' . $demo_link . '">' . $item["title"] . '</a>'; // } $tpl_pinfo = new ilTemplate('tpl.shop_item_info.html', true, true, 'Services/Payment'); if ($item['price_string'] != '') { $tpl_pinfo->setCurrentBlock('ploop'); $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('price_a')); $tpl_pinfo->setVariable('VALUE', $item['price_string']); $tpl_pinfo->parseCurrentBlock(); } if ($item['author'] != '') { $tpl_pinfo->setCurrentBlock('ploop'); $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('author')); $tpl_pinfo->setVariable('VALUE', $item['author']); $tpl_pinfo->parseCurrentBlock(); } $oFile = new ilFileDataShop(ilPaymentObject::_lookupPobjectId($item['ref_id'])); if (($webpath_file = $oFile->getCurrentImageWebPath()) !== false) { $tpl_pinfo->setCurrentBlock('image'); $tpl_pinfo->setVariable('SRC', $webpath_file); $tpl_pinfo->setVariable('ALT', strip_tags($item['title'])); $tpl_pinfo->parseCurrentBlock(); } $item_list_gui->addSubItemHTML($tpl_pinfo->get()); $html = $item_list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], false, false, "", ilObjectListGUI::CONTEXT_SHOP); return array($item, $html); }
/** * Set header action menu */ function initHeaderAction() { // check access for object if ($this->node_id && !$this->access_handler->checkAccess("visible", "", $this->node_id) && !$this->access_handler->checkAccess("read", "", $this->node_id)) { return; } include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php'; $this->header_action = ilObjectListGUIFactory::_getListGUIByType($this->obj_type); // remove all currently unwanted actions $this->header_action->enableCopy(false); $this->header_action->enableCut(false); $this->header_action->enableDelete(false); $this->header_action->enableLink(false); $this->header_action->enableInfoscreen(false); $this->header_action->enablePayment(false); $this->header_action->enableTimings(false); switch ($this->node_type) { case self::TYPE_REPOSITORY: $this->header_action->enableSubscribe(true); $context = ilObjectListGUI::CONTEXT_REPOSITORY; break; case self::TYPE_WORKSPACE: $this->header_action->enableSubscribe(false); $context = ilObjectListGUI::CONTEXT_WORKSPACE; break; } $this->header_action->initItem($this->node_id, $this->obj_id, "", "", $context); $this->header_action->setHeaderSubObject($this->sub_type, $this->sub_id); $this->header_action->setAjaxHash($this->getAjaxHash()); return $this->header_action; }
/** * Get item list command drop down asynchronously */ function getAsynchItemListObject() { global $ilCtrl; $ref_id = $_GET["cmdrefid"]; $obj_id = ilObject::_lookupObjId($ref_id); $type = ilObject::_lookupType($obj_id); // this should be done via container-object->getSubItem in the future $data = array("child" => $ref_id, "ref_id" => $ref_id, "obj_id" => $obj_id, "type" => $type); include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php'; $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($type); $item_list_gui->setContainerObject($this); $item_list_gui->enableComments(true); $item_list_gui->enableNotes(true); $item_list_gui->enableTags(true); $this->modifyItemGUI($item_list_gui, $data, false); $html = $item_list_gui->getListItemHTML($ref_id, $obj_id, "", "", true, true); // include plugin slot for async item list global $ilPluginAdmin; $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk"); foreach ($pl_names as $pl) { $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl); $gui_class = $ui_plugin->getUIClassInstance(); $resp = $gui_class->getHTML("Services/Container", "async_item_list", array("html" => $html)); if ($resp["mode"] != ilUIHookPluginGUI::KEEP) { $html = $gui_class->modifyHTML($html, $resp); } } echo $html; exit; }
private function renderItems($oContainerTpl, $results, $topic) { // main shop_content global $ilUser; $items_counter = 0; $cur_obj_type = ''; $tpl = $this->newBlockTemplate(); $first = true; foreach ($this->type_ordering as $act_type) { $item_html = array(); if (count($results[$topic['id']][$act_type])) { foreach ($results[$topic['id']][$act_type] as $key => $item) { // price presentation $oPaymentObject = new ilPaymentObject($ilUser, ilPaymentObject::_lookupPobjectId($item['ref_id'])); $oPrice = new ilPaymentPrices((int) $oPaymentObject->getPobjectId()); $lowest_price = $oPrice->getLowestPrice(); $special_icon = ' '; if ($oPaymentObject->getSpecial() == '1') { $special_icon = ilShopUtils::_getSpecialObjectSymbol(); } $results[$topic['id']][$act_type][$key]['title'] = $item['title'] . ' ' . ($results[$topic['id']][$act_type][$key]['special_icon'] = $special_icon); $results[$topic['id']][$act_type][$key]['price'] = $lowest_price['price']; $paymethod_icon = ilShopUtils::_getPaymethodSymbol($oPaymentObject->getPayMethod()); // if(!ilPaymentObject::_hasAccess($item['ref_id'])) // { $shoppingcart_icon = ilShopUtils::_addToShoppingCartSymbol($act_type, $item['ref_id']); // } // else $shoppingcart_icon = ''; $results[$topic['id']][$act_type][$key]['price_string'] = ($oPrice->getNumberOfPrices() > 1 ? $this->lng->txt('price_from') . ' ' : '') . ilPaymentPrices::_formatPriceToString($lowest_price['price']) . ' ' . ($results[$topic['id']][$act_type][$key]['shoppingcart_icon'] = $shoppingcart_icon . ' ' . ($results[$topic['id']][$act_type][$key]['paymethod_icon'] = $paymethod_icon)); // authors include_once 'Services/MetaData/classes/class.ilMD.php'; $md_obj = new ilMD($item['obj_id'], 0, $item['type']); if (is_object($md_section = $md_obj->getLifecycle())) { $sep = $ent_str = ""; foreach ($ids = $md_section->getContributeIds() as $con_id) { $md_con = $md_section->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $ent_str = $ent_str . $sep . $md_ent->getEntity(); $sep = ", "; } } } $results[$topic['id']][$act_type][$key]['author'] = $ent_str; } } $results[$topic['id']][$act_type] = $this->sortResult($results[$topic['id']][$act_type]); foreach ($results[$topic['id']][$act_type] as $key => $item) { // get list gui class for each object type if ($cur_obj_type != $item['type']) { include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php'; $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item['type']); } $item_list_gui->initItem($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], ilObjectListGUI::CONTEXT_SHOP); $item_list_gui->enableDelete(false); $item_list_gui->enableCut(false); $item_list_gui->enableCopy(false); $item_list_gui->enableLink(false); $item_list_gui->enableSubscribe(false); $item_list_gui->enablePayment(true); $item_list_gui->enableCommands(true); $item_list_gui->enablePath(false); $item_list_gui->insertCommands(); $item_list_gui->enableInfoScreen(false); $item_list_gui->enableSubstitutions(false); $item_list_gui->enableNoticeProperties(false); $item_list_gui->enablePreconditions(false); $item_list_gui->enableProperties(false); $item_list_gui->setBoldTitle(true); if (ilPaymentObject::_hasAccess($item['ref_id'])) { $item_list_gui->enableInfoScreen(true); $item_list_gui->enableCommands(true); } else { switch ($item['type']) { case 'sahs': $demo_link = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo'; break; case 'lm': $demo_link = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo'; break; case 'exc': $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"]; break; default: $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"]; break; } $item['title'] = '<a href="' . $demo_link . '">' . $item["title"] . '</a>'; } $tpl_pinfo = new ilTemplate('tpl.shop_item_info.html', true, true, 'Services/Payment'); if ($item['price_string'] != '') { $tpl_pinfo->setCurrentBlock('ploop'); $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('price_a')); $tpl_pinfo->setVariable('VALUE', $item['price_string']); $tpl_pinfo->parseCurrentBlock(); } if ($item['author'] != '') { $tpl_pinfo->setCurrentBlock('ploop'); $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('author')); $tpl_pinfo->setVariable('VALUE', $item['author']); $tpl_pinfo->parseCurrentBlock(); } $oFile = new ilFileDataShop(ilPaymentObject::_lookupPobjectId($item['ref_id'])); if (($webpath_file = $oFile->getCurrentImageWebPath()) !== false) { $tpl_pinfo->setCurrentBlock('image'); $tpl_pinfo->setVariable('SRC', $webpath_file); $tpl_pinfo->setVariable('ALT', strip_tags($item['title'])); $tpl_pinfo->parseCurrentBlock(); } $item_list_gui->addSubItemHTML($tpl_pinfo->get()); $html = $item_list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], false, false, "", ilObjectListGUI::CONTEXT_SHOP); if ($html) { $html = $this->__appendChildLinks($html, $item, $item_list_gui); $item_html[$item['ref_id']] = $html; } } // output block for resource type if (count($item_html) > 0) { // separator row if (!$first) { $this->addSeparatorRow($tpl); } $first = false; // add a header for each resource type $this->addHeaderRow($tpl, $act_type); $this->resetRowType(); // content row foreach ($item_html as $ref_id => $html) { $this->addStandardRow($tpl, $html, $ref_id); } ++$items_counter; } } } if ($items_counter > 0) { $oContainerTpl->setCurrentBlock('loop'); $oContainerTpl->setVariable('TOPIC_TITLE', $topic['title']); $oContainerTpl->setVariable('COTAINER_LIST_BLOCK', $tpl->get()); $oContainerTpl->parseCurrentBlock(); global $tpl; $tpl->setContent($oContainerTpl->get()); } }
/** * Set Course title and icon in header * */ protected function initHeader() { $lgui = ilObjectListGUIFactory::_getListGUIByType($this->crs->getType()); $this->tpl->setTitle($this->crs->getTitle()); $this->tpl->setDescription($this->crs->getDescription()); if ($this->crs->getOfflineStatus()) { $this->tpl->setAlertProperties($lgui->getAlertProperties()); } $this->tpl->setTitleIcon(ilUtil::getTypeIconPath('crs', $this->crs->getId(), 'big')); $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->ref_id); $this->tabs->setBackTarget($this->pl->txt('back_to_course'), $this->ctrl->getLinkTargetByClass('ilrepositorygui')); }