private function renderItems($oContainerTpl, $results, $topic) { // main shop_content global $ilUser; $items_counter = 0; $cur_obj_type = ''; $tpl = $this->newBlockTemplate(); foreach ($this->type_ordering as $act_type) { $item_html = array(); if (count($results[(int) $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()); $shoppingcart_icon = ilShopUtils::_addToShoppingCartSymbol($item['ref_id']); $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 list($item, $html) = $this->getObjectListItem($cur_obj_type, $item); if ($html) { $item_html[$item['ref_id']] = $html; } } // output block for resource type if (count($item_html) > 0) { // add a header for each resource type $tpl->setCurrentBlock("container_header_row_image"); $tpl->setVariable("HEADER_IMG", ilObject::_getIcon('', '', $act_type)); $tpl->setVariable("HEADER_ALT", $this->lng->txt("objs_" . $act_type)); $tpl->setVariable("BLOCK_HEADER_CONTENT", $this->lng->txt("objs_" . $act_type)); $this->resetRowType(); // content row foreach ($item_html as $ref_id => $html) { $this->addStandardRow($tpl, $html); } ++$items_counter; } } } if ($items_counter > 0) { $oContainerTpl->setCurrentBlock('loop_item'); $oContainerTpl->setCurrentBlock('topic_title'); $oContainerTpl->setVariable('TOPIC_TITLE', $topic['title']); $oContainerTpl->parseCurrentBlock('topic_title'); $oContainerTpl->setVariable('CONTAINER_LIST_BLOCK', $html); $oContainerTpl->parseCurrentBlock('loop_item'); $tpl->setContent($oContainerTpl->get()); $container_html = $tpl->get(); return $container_html; } }
/** * add standard meta data sections */ function addMetaDataSections($a_rep_obj_id, $a_obj_id, $a_type) { global $lng; $lng->loadLanguageModule("meta"); include_once "./Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($a_rep_obj_id, $a_obj_id, $a_type); if ($md_gen = $md->getGeneral()) { // get first descrption // The description is shown on the top of the page. // Thus it is not necessary to show it again. foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); break; } // get language(s) $langs = array(); foreach ($ids = $md_gen->getLanguageIds() as $id) { $md_lan = $md_gen->getLanguage($id); if ($md_lan->getLanguageCode() != "") { $langs[] = $lng->txt("meta_l_" . $md_lan->getLanguageCode()); } } $langs = implode($langs, ", "); // keywords $keywords = array(); foreach ($ids = $md_gen->getKeywordIds() as $id) { $md_key = $md_gen->getKeyword($id); $keywords[] = $md_key->getKeyword(); } $keywords = implode($keywords, ", "); } // authors if (is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach ($ids = $lifecycle->getContributeIds() as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author . $sep . $md_ent->getEntity(); $sep = ", "; } } } } // copyright $copyright = ""; if (is_object($rights = $md->getRights())) { include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($rights->getDescription()); } // learning time #if(is_object($educational = $md->getEducational())) #{ # $learning_time = $educational->getTypicalLearningTime(); #} $learning_time = ""; if (is_object($educational = $md->getEducational())) { if ($seconds = $educational->getTypicalLearningTimeSeconds()) { $learning_time = ilFormat::_secondsToString($seconds); } } // output // description if ($description != "") { $this->addSection($lng->txt("description")); $this->addProperty("", nl2br($description)); } // general section $this->addSection($lng->txt("meta_general")); if ($langs != "") { $this->addProperty($lng->txt("language"), $langs); } if ($keywords != "") { $this->addProperty($lng->txt("keywords"), $keywords); } if ($author != "") { $this->addProperty($lng->txt("author"), $author); } if ($copyright != "") { $this->addProperty($lng->txt("meta_copyright"), $copyright); } if ($learning_time != "") { $this->addProperty($lng->txt("meta_typical_learning_time"), $learning_time); } }
function updateQuickEdit_scorm_propagate($request, $type) { $module_id = $this->md_obj->obj_id; if ($this->md_obj->obj_type == 'sco') { $module_id = $this->md_obj->rbac_id; } $tree = new ilTree($module_id); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) { $sco_md = new ilMD($module_id, $sco['obj_id'], 'sco'); if ($_POST[$request] != "") { $sco_md_section; if (!is_object($sco_md_section = $sco_md->getLifecycle())) { $sco_md_section = $sco_md->addLifecycle(); $sco_md_section->save(); } // determine all entered authors $auth_arr = explode(",", $_POST[$request]); for ($i = 0; $i < count($auth_arr); $i++) { $auth_arr[$i] = trim($auth_arr[$i]); } $md_con_author = ""; // update existing author entries (delete if not entered) foreach ($ids = $sco_md_section->getContributeIds() as $con_id) { $md_con = $sco_md_section->getContribute($con_id); if ($md_con->getRole() == $type) { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); // entered author already exists if (in_array($md_ent->getEntity(), $auth_arr)) { unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]); } else { $md_ent->delete(); } } $md_con_author = $md_con; } } // insert enterd, but not existing authors if (count($auth_arr) > 0) { if (!is_object($md_con_author)) { $md_con_author = $sco_md_section->addContribute(); $md_con_author->setRole($type); $md_con_author->save(); } foreach ($auth_arr as $auth) { $md_ent = $md_con_author->addEntity(); $md_ent->setEntity(ilUtil::stripSlashes($auth)); $md_ent->save(); } } } else { if (is_object($sco_md_section = $sco_md->getLifecycle())) { foreach ($ids = $sco_md_section->getContributeIds() as $con_id) { $md_con = $sco_md_section->getContribute($con_id); if ($md_con->getRole() == $type) { $md_con->delete(); } } } } $sco_md->update(); } $this->updateQuickEdit_scorm(); }
/** * show print view */ function showPrintView() { global $ilUser, $lng, $ilCtrl; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (!$this->lm->isActivePrintView()) { return; } $this->renderPageTitle(); $c_obj_id = $this->getCurrentPageId(); // set values according to selection if ($_POST["sel_type"] == "page") { if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) { $_POST["obj_id"][] = $c_obj_id; } } if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) { $path = $this->lm_tree->getPathFull($c_obj_id); $chap_id = $path[1]["child"]; if ($chap_id > 0) { $_POST["obj_id"][] = $chap_id; } } //var_dump($_GET); //var_dump($_POST); // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } // content style $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true); // set title header $this->tpl->setVariable("HEADER", $this->lm->getTitle()); $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId())); include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php"; include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; include_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; $act_level = 99999; $activated = false; $glossary_links = array(); $output_header = false; $media_links = array(); // get header and footer if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getFooterPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $footer_page_content = $page_object_gui->showPage(); } } if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getHeaderPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $header_page_content = $page_object_gui->showPage(); } } // add free selected pages if (is_array($_POST["obj_id"])) { foreach ($_POST["obj_id"] as $k) { if ($k > 0 && !$this->lm_tree->isInTree($k)) { if (ilLMObject::_lookupType($k) == "pg") { $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true); } } } } else { ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true); $ilCtrl->redirect($this, "showPrintViewSelection"); } foreach ($nodes as $node_key => $node) { // check page activation $active = ilLMPage::_lookupActive($node["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($node["type"] == "pg" && !$active) { continue; } // print all subchapters/subpages if higher chapter // has been selected if ($node["depth"] <= $act_level) { if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) { $act_level = $node["depth"]; $activated = true; } else { $act_level = 99999; $activated = false; } } if ($activated && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) { // output learning module header if ($node["type"] == "du") { $output_header = true; } // output chapter title if ($node["type"] == "st") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $chap = new ilStructureObject($this->lm, $node["obj_id"]); $this->tpl->setCurrentBlock("print_chapter"); $chapter_title = $chap->_getPresentationTitle($node["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang); $this->tpl->setVariable("CHAP_TITLE", $chapter_title); if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($nodes[$node_key + 1]["type"] == "pg") { $this->tpl->setVariable("CHAP_HEADER", $header_page_content); $did_chap_page_header = true; } } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); } // output page if ($node["type"] == "pg") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $this->tpl->setCurrentBlock("print_item"); // get page $page_id = $node["obj_id"]; $page_object_gui = $this->getLMPageGUI($page_id); $page_object = $page_object_gui->getPageObject(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // get lm page $lm_pg_obj = new ilLMPageObject($this->lm, $page_id); $lm_pg_obj->setLMId($this->lm->getId()); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) { $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); // prevent page title after chapter title // that have the same content if ($this->lm->isActiveNumbering()) { $chapter_title = trim(substr($chapter_title, strpos($chapter_title, " "))); } if ($page_title != $chapter_title) { $page_object_gui->setPresentationTitle($page_title); } } // handle header / footer $hcont = $header_page_content; $fcont = $footer_page_content; if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($did_chap_page_header) { $hcont = ""; } if ($nodes[$node_key + 1]["type"] == "pg" && !($nodes[$node_key + 1]["depth"] <= $act_level && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) { $fcont = ""; } } $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $page_content = $page_object_gui->showPage(); if ($this->lm->getPageHeader() != IL_PAGE_TITLE) { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont); } else { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont . "<br />"); } $chapter_title = ""; $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); // get internal links $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]); $got_mobs = false; foreach ($int_links as $key => $link) { if ($link["type"] == "git" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $glossary_links[$key] = $link; } if ($link["type"] == "mob" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $got_mobs = true; $mob_links[$key] = $link; } } // this is not cool because of performance reasons // unfortunately the int link table does not // store the target frame (we want to append all linked // images but not inline images (i.e. mobs with no target // frame)) if ($got_mobs) { $page_object->buildDom(); $links = $page_object->getInternalLinks(); foreach ($links as $link) { if ($link["Type"] == "MediaObject" && $link["TargetFrame"] != "" && $link["TargetFrame"] != "None") { $media_links[] = $link; } } } } } } $annex_cnt = 0; $annexes = array(); // glossary if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) { include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; // sort terms $terms = array(); foreach ($glossary_links as $key => $link) { $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]); $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term); } $terms = ilUtil::sortArray($terms, "term", "asc"); //ksort($terms); foreach ($terms as $t) { $link = $t["link"]; $key = $t["key"]; $defs = ilGlossaryDefinition::getDefinitionList($link["id"]); $def_cnt = 1; // output all definitions of term foreach ($defs as $def) { // definition + number, if more than 1 definition if (count($defs) > 1) { $this->tpl->setCurrentBlock("def_title"); $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . $def_cnt++); $this->tpl->parseCurrentBlock(); } include_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php"; $page_gui = new ilGlossaryDefPageGUI($def["id"]); $page_gui->setTemplateOutput(false); $page_gui->setOutputMode("print"); $this->tpl->setCurrentBlock("definition"); $page_gui->setFileDownloadLink("#"); $page_gui->setFullscreenLink("#"); $page_gui->setSourceCodeDownloadScript("#"); $output = $page_gui->showPage(); $this->tpl->setVariable("VAL_DEFINITION", $output); $this->tpl->parseCurrentBlock(); } // output term $this->tpl->setCurrentBlock("term"); $this->tpl->setVariable("VAL_TERM", $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"])); $this->tpl->parseCurrentBlock(); } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("glossary"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo"); $this->tpl->setVariable("TXT_GLOSSARY", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // referenced images if (count($media_links) > 0) { include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Services/MediaObjects/classes/class.ilMediaItem.php"; foreach ($media_links as $media) { if (substr($media["Target"], 0, 4) == "il__") { $arr = explode("_", $media["Target"]); $id = $arr[count($arr) - 1]; $med_obj = new ilObjMediaObject($id); $med_item = $med_obj->getMediaItem("Standard"); if (is_object($med_item)) { if (is_int(strpos($med_item->getFormat(), "image"))) { $this->tpl->setCurrentBlock("ref_image"); // image source if ($med_item->getLocationType() == "LocalFile") { $this->tpl->setVariable("IMG_SOURCE", ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id . "/" . $med_item->getLocation()); } else { $this->tpl->setVariable("IMG_SOURCE", $med_item->getLocation()); } if ($med_item->getCaption() != "") { $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption()); } else { $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle()); } $this->tpl->parseCurrentBlock(); } } } } // output glossary header $annex_cnt++; $this->tpl->setCurrentBlock("ref_images"); $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images"); $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title); $this->tpl->parseCurrentBlock(); $annexes[] = $annex_title; } // output learning module title and toc if ($output_header) { $this->tpl->setCurrentBlock("print_header"); $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle()); if ($this->lm->getDescription() != "none") { include_once "Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); $md_gen = $md->getGeneral(); foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); } $this->tpl->setVariable("LM_DESCRIPTION", $description); } $this->tpl->parseCurrentBlock(); // output toc $nodes2 = $nodes; foreach ($nodes2 as $node2) { if ($node2["type"] == "st" && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) { for ($j = 1; $j < $node2["depth"]; $j++) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", ilStructureObject::_getPresentationTitle($node2["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang)); $this->tpl->parseCurrentBlock(); } } // annexes foreach ($annexes as $annex) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", $annex); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc"); $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_start_block"); $this->tpl->parseCurrentBlock(); } // output author information include_once 'Services/MetaData/classes/class.ilMD.php'; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); if (is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach ($ids = $lifecycle->getContributeIds() as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author . $sep . $md_ent->getEntity(); $sep = ", "; } } } if ($author != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("author"); $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author")); $this->tpl->setVariable("LM_AUTHOR", $author); $this->tpl->parseCurrentBlock(); } } // output copyright information if (is_object($md_rights = $md->getRights())) { $copyright = $md_rights->getDescription(); include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($copyright); if ($copyright != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("copyright"); $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright")); $this->tpl->setVariable("LM_COPYRIGHT", $copyright); $this->tpl->parseCurrentBlock(); } } $this->tpl->show(false); }
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()); } }