本文整理汇总了PHP中ilLMObject类的典型用法代码示例。如果您正苦于以下问题:PHP ilLMObject类的具体用法?PHP ilLMObject怎么用?PHP ilLMObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilLMObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNodeContent
/**
* Get node content
*
* @param array $a_node node array
* @return string node content
*/
function getNodeContent($a_node)
{
if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
return $this->lm->getTitle();
}
$lang = $_GET["transl"] != "" ? $_GET["transl"] : "-";
return ilLMObject::_getPresentationTitle($a_node, IL_PAGE_TITLE, $this->lm->isActiveNumbering(), false, false, $this->lm->getId(), $lang);
}
示例2: __construct
/**
* Constructor
*
* @param object $a_parent_obj parent gui object
* @param string $a_parent_cmd parent cmd
* @param ilLMPresentationGUI $a_lm_pres learning module presentation gui object
* @param string $a_lang language
*/
function __construct($a_parent_obj, $a_parent_cmd, ilLMPresentationGUI $a_lm_pres, $a_lang = "-")
{
parent::__construct($a_parent_obj, $a_parent_cmd, $a_lm_pres, $a_lang);
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
$chaps = ilLMObject::_getAllLMObjectsOfLM($this->lm->getId(), $a_type = "st");
foreach ($chaps as $c) {
$this->setNodeOpen($c);
}
}
示例3: getHTML
/**
* get html
* @return
*/
public function getHTML()
{
global $lng, $ilUser;
include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
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('SEPERATOR', ':');
switch (ilLMObject::_lookupType($sub_item, $this->getObjId())) {
case 'pg':
$this->getItemListGUI()->setChildId($sub_item);
$this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_pg'));
$link = $this->getItemListGUI()->getCommandLink('page');
include_once './Services/Search/classes/class.ilUserSearchCache.php';
$link .= '&srcstring=1';
$this->tpl->setVariable('LINK', $link);
$this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
$this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
break;
case 'st':
$this->getItemListGUI()->setChildId($sub_item);
$this->tpl->setVariable("SUBITEM_TYPE", $lng->txt('obj_st'));
$link = $this->getItemListGUI()->getCommandLink('page');
include_once './Services/Search/classes/class.ilUserSearchCache.php';
$link .= '&srcstring=1';
$this->tpl->setVariable('LINK', $link);
$this->tpl->setVariable('TARGET', $this->getItemListGUI()->getCommandFrame('page'));
$this->tpl->setVariable('TITLE', ilLMObject::_lookupTitle($sub_item));
break;
default:
if (ilObject::_lookupType($sub_item) != 'file') {
return '';
}
$this->getItemListGUI()->setChildId('il__file_' . $sub_item);
$this->tpl->setVariable('SUBITEM_TYPE', $lng->txt('obj_file'));
$link = $this->getItemListGUI()->getCommandLink('downloadFile');
$this->tpl->setVariable('LINK', $link);
$this->tpl->setVariable('TITLE', ilObject::_lookupTitle($sub_item));
break;
}
if (count($this->getSubItemIds(true)) > 1) {
$this->parseRelevance($sub_item);
}
$this->tpl->parseCurrentBlock();
}
$this->showDetailsLink();
return $this->tpl->get();
}
示例4: delete_rec
/**
* Delete sub tree
*/
private function delete_rec(&$a_tree, $a_delete_meta_data = true)
{
$childs = $a_tree->getChilds($this->getId());
foreach ($childs as $child) {
$obj =& ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
if (is_object($obj)) {
if ($obj->getType() == "st") {
$obj->delete_rec($a_tree, $a_delete_meta_data);
}
if ($obj->getType() == "pg") {
$obj->delete($a_delete_meta_data);
}
}
unset($obj);
}
parent::delete($a_delete_meta_data);
}
示例5: getXmlExportTailDependencies
/**
* Get tail dependencies
*
* @param string entity
* @param string target release
* @param array ids
* @return array array of array with keys "component", entity", "ids"
*/
function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
{
if ($a_target_release == "4.3.0") {
if ($a_entity == "help") {
$lm_node_ids = array();
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
foreach ($a_ids as $lm_id) {
$chaps = ilLMObject::getObjectList($lm_id, "st");
foreach ($chaps as $chap) {
$lm_node_ids[] = $chap["obj_id"];
}
}
return array(array("component" => "Services/Help", "entity" => "help_map", "ids" => $lm_node_ids), array("component" => "Services/Help", "entity" => "help_tooltip", "ids" => $a_ids));
}
}
return array();
}
示例6: isClickable
/**
* check if links for certain object type are activated
*
* @param string $a_type object type
*
* @return boolean true if linking is activated
*/
function isClickable($a_type, $a_obj_id = 0)
{
global $ilUser;
// in this standard implementation
// only the type determines, wether an object should be clickable or not
// but this method can be overwritten and make use of the ref id
// (this happens e.g. in class ilRepositoryExplorerGUI)
if ($this->is_clickable[$a_type] == "n") {
return false;
}
// check public access
include_once 'Services/Payment/classes/class.ilPaymentObject.php';
if (($ilUser->getId() == ANONYMOUS_USER_ID || ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm_obj->getRefId())) && !ilLMObject::_isPagePublic($a_obj_id, true)) {
return false;
}
return true;
}
示例7: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $ilCtrl, $lng;
$this->tpl->setVariable("PAGE_TITLE", ilLMObject::_lookupTitle($a_set["page_id"]));
$this->tpl->setVariable("QUESTION", assQuestion::_getQuestionText($a_set["question_id"]));
include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
$stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
$this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
if ($stats["all"] == 0) {
$this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
$this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
$this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
$this->tpl->setVariable("VAL_NEVER", 0);
} else {
$this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] . " (" . 100 / $stats["all"] * $stats["first"] . " %)");
$this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] . " (" . 100 / $stats["all"] * $stats["second"] . " %)");
$this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] . " (" . 100 / $stats["all"] * $stats["third_or_more"] . " %)");
$nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
$this->tpl->setVariable("VAL_NEVER", $nev . " (" . 100 / $stats["all"] * $nev . " %)");
}
}
示例8: getParentObjectIdForUsage
//.........这里部分代码省略.........
// temporary items (per user)
// temporary items (per user)
case "frm~":
case "exca~":
$obj_id = $a_usage['id'];
break;
// "old" category pages
// "old" category pages
case "cat":
// InfoScreen Text
// InfoScreen Text
case "tst":
case "svy":
// data collection
// data collection
case "dcl":
$obj_id = $id;
break;
}
break;
// page editor
// page editor
case "pg":
switch ($cont_type) {
case "qpl":
// Question Pool Question Pages
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$qinfo = assQuestion::_getQuestionInfo($id);
if ($qinfo["original_id"] > 0) {
include_once "./Modules/Test/classes/class.ilObjTest.php";
$obj_id = ilObjTest::_lookupTestObjIdForQuestionId($id);
// usage in test
} else {
$obj_id = $qinfo["obj_fi"];
// usage in pool
}
break;
case "lm":
case "dbk":
// learning modules
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
$obj_id = ilLMObject::_lookupContObjID($id);
break;
case "gdf":
// glossary definition
include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
$term_id = ilGlossaryDefinition::_lookupTermId($id);
$obj_id = ilGlossaryTerm::_lookGlossaryID($term_id);
break;
case "wpg":
// wiki page
include_once 'Modules/Wiki/classes/class.ilWikiPage.php';
$obj_id = ilWikiPage::lookupObjIdByPage($id);
break;
case "sahs":
// sahs page
// can this implementation be used for other content types, too?
include_once './Services/COPage/classes/class.ilPageObject.php';
$obj_id = ilPageObject::lookupParentId($id, 'sahs');
break;
case "prtf":
// portfolio
include_once "Modules/Portfolio/classes/class.ilPortfolioPage.php";
$obj_id = ilPortfolioPage::findPortfolioForPage($id);
break;
case "prtt":
// portfolio template
include_once "Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php";
$obj_id = ilPortfolioTemplatePage::findPortfolioForPage($id);
break;
case "blp":
// blog
include_once './Services/COPage/classes/class.ilPageObject.php';
$obj_id = ilPageObject::lookupParentId($id, 'blp');
break;
case "crs":
case "grp":
case "cat":
case "fold":
case "root":
// repository pages
$obj_id = $id;
break;
}
break;
// Media Pool
// Media Pool
case "mep":
$obj_id = $id;
break;
// News Context Object (e.g. MediaCast)
// News Context Object (e.g. MediaCast)
case "news":
include_once "./Services/News/classes/class.ilNewsItem.php";
$obj_id = ilNewsItem::_lookupContextObjId($id);
break;
}
return $obj_id;
}
示例9: insertPageClip
/**
* Insert pages from clipboard
*/
function insertPageClip()
{
global $ilCtrl, $ilUser;
include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
$node_id = ilChapterHierarchyFormGUI::getPostNodeId();
$first_child = ilChapterHierarchyFormGUI::getPostFirstChild();
if (!$first_child) {
$parent_id = $this->tree->getParentId($node_id);
$target = $node_id;
} else {
$parent_id = $node_id;
$target = IL_FIRST_NODE;
}
// cut and paste
$pages = $ilUser->getClipboardObjects("pg");
$copied_nodes = array();
foreach ($pages as $pg) {
$cid = ilLMObject::pasteTree($this->content_object, $pg["id"], $parent_id, $target, $pg["insert_time"], $copied_nodes, ilEditClipboard::getAction() == "copy");
$target = $cid;
}
ilLMObject::updateInternalLinks($copied_nodes);
if (ilEditClipboard::getAction() == "cut") {
$ilUser->clipboardDeleteObjectsOfType("pg");
$ilUser->clipboardDeleteObjectsOfType("st");
ilEditClipboard::clear();
}
$ilCtrl->redirect($this, "view");
}
示例10: fillRow
/**
* Fill table row
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl;
//var_dump($a_set);
// icon...
// check activation
include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
$active = ilLMPage::_lookupActive($a_set["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation"));
// is page scheduled?
$img_sc = $this->lm_set->get("time_scheduled_page_activation") && ilLMPage::_isScheduledActivation($a_set["obj_id"], $this->lm->getType()) ? "_sc" : "";
if (!$active) {
$img = "icon_pg_d" . $img_sc . ".svg";
$alt = $lng->txt("cont_page_deactivated");
} else {
if (ilLMPage::_lookupContainsDeactivatedElements($a_set["obj_id"], $this->lm->getType())) {
$img = "icon_pg_del" . $img_sc . ".svg";
$alt = $lng->txt("cont_page_deactivated_elements");
} else {
$img = "icon_pg" . $img_sc . ".svg";
$alt = $this->lng->txt("pg");
}
}
$this->tpl->setVariable("ICON", ilUtil::img(ilUtil::getImagePath($img), $alt));
// title/link
$ilCtrl->setParameter($this, "backcmd", "");
$ilCtrl->setParameterByClass("ilLMPageObjectGUI", "obj_id", $a_set["obj_id"]);
$this->tpl->setVariable("HREF_TITLE", $ilCtrl->getLinkTargetByClass("ilLMPageObjectGUI", "edit"));
$this->tpl->setVariable("TITLE", $a_set["title"]);
$this->tpl->setVariable("ID", $a_set["obj_id"]);
// context
if ($this->lm->lm_tree->isInTree($a_set["obj_id"])) {
$path_str = $this->parent_obj->getContextPath($a_set["obj_id"]);
} else {
$path_str = "---";
}
// check whether page is header or footer
$add_str = "";
if ($a_set["obj_id"] == $this->lm->getHeaderPage()) {
$add_str = " <b>(" . $lng->txt("cont_header") . ")</b>";
}
if ($a_set["obj_id"] == $this->lm->getFooterPage()) {
$add_str .= " <b>(" . $lng->txt("cont_footer") . ")</b>";
}
$this->tpl->setVariable("USAGE", $path_str . $add_str);
// layout
if ($this->lm->getLayoutPerPage()) {
if (($l = ilLMObject::lookupLayout($a_set["obj_id"])) != "") {
$this->tpl->setVariable("LAYOUT", $lng->txt("cont_layout_" . $l));
}
}
}
示例11: renderObjective
/**
* render objective
*
* @access protected
* @param int objective id
* @param bool co page status
* @param ilAccordionGUI $a_accordion
* @param array $a_lo_result
* @return string html
*/
protected function renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion = null, array $a_lo_result = null)
{
global $ilUser, $lng;
include_once './Modules/Course/classes/class.ilCourseObjective.php';
$objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id);
include_once './Services/Container/classes/class.ilContainerSorting.php';
include_once './Services/Object/classes/class.ilObjectActivation.php';
$items = ilObjectActivation::getItemsByObjective($a_objective_id);
// sorting is handled by ilCourseObjectiveMaterials
// $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items);
include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
$objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
// #13381 - map material assignment to position
$sort_map = array();
foreach ($objectives_lm_obj->getMaterials() as $item) {
$sort_map[$item["lm_ass_id"]] = $item["position"];
}
$is_manage = $this->getContainerGUI()->isActiveAdministrationPanel();
$is_order = $this->getContainerGUI()->isActiveOrdering();
$sort_content = array();
foreach ($items as $item) {
if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) {
continue;
}
$item_list_gui2 = $this->getItemGUI($item);
$item_list_gui2->enableIcon(true);
if ($is_order || $a_accordion) {
$item_list_gui2->enableCommands(true, true);
$item_list_gui2->enableProperties(false);
}
$chapters = $objectives_lm_obj->getChapters();
if (count($chapters)) {
$has_sections = false;
foreach ($chapters as $chapter) {
if ($chapter['ref_id'] != $item['child']) {
continue;
}
$has_sections = true;
include_once './Modules/LearningModule/classes/class.ilLMObject.php';
$title = $item['title'] . " › " . ilLMObject::_lookupTitle($chapter['obj_id']) . " (" . $lng->txt('obj_' . $chapter['type']) . ")";
$item_list_gui2->setDefaultCommandParameters(array("obj_id" => $chapter['obj_id'], "focus_id" => $chapter['obj_id'], "focus_return" => $this->container_obj->getRefId()));
if ($is_order) {
$item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]", sprintf('%d', $chapter['position'] * 10));
}
$sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $title, $item['description']);
// #13381 - use materials order
$sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id'];
$sort_content[$sort_key] = $sub_item_html;
}
}
$this->rendered_items[$item['child']] = true;
if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) {
if ($is_order) {
$item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]", sprintf('%d', $sort_map[$lm_ass_id] * 10));
}
$sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']);
// #13381 - use materials order
$sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id;
$sort_content[$sort_key] = $sub_item_html;
}
}
if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) {
$this->objective_list_gui->enableCommands(false);
} else {
$this->objective_list_gui->enableCommands(true);
}
if ($is_order) {
$this->objective_list_gui->setPositionInputField("[lobj][" . $a_objective_id . "][0]", $objective->__getPosition() * 10);
}
ksort($sort_content);
if (!$a_accordion) {
foreach ($sort_content as $sub_item_html) {
$this->objective_list_gui->addSubItemHTML($sub_item_html);
}
return $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription(), $is_manage || $is_order);
} else {
$acc_content = $sort_content;
$initial_shown = false;
if ($this->getSettings()->hasSeparateInitialTests() and !$a_lo_result['initial_status']) {
$acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL), $a_objective_id, true, false, $a_lo_result);
$initial_shown = TRUE;
} elseif ($this->getSettings()->hasSeparateQualifiedTests()) {
$acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED), $a_objective_id, false, false, $a_lo_result);
}
/*
if($this->loc_settings->getInitialTest() &&
$this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL &&
!$a_lo_result["initial_status"])
{
$acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result);
//.........这里部分代码省略.........
示例12: moveIntLinks
function moveIntLinks($a_from_to)
{
$this->buildDom();
$changed = false;
// resolve normal internal links
$xpc = xpath_new_context($this->dom);
$path = "//IntLink";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$target = $res->nodeset[$i]->get_attribute("Target");
$type = $res->nodeset[$i]->get_attribute("Type");
$obj_id = ilInternalLink::_extractObjIdOfTarget($target);
if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, "__"))) {
if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") {
$res->nodeset[$i]->set_attribute("Target", "il__pg_" . $a_from_to[$obj_id]);
$changed = true;
}
if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") {
$res->nodeset[$i]->set_attribute("Target", "il__st_" . $a_from_to[$obj_id]);
$changed = true;
}
}
}
unset($xpc);
// map areas
$this->addHierIDs();
$xpc = xpath_new_context($this->dom);
$path = "//MediaAlias";
$res =& xpath_eval($xpc, $path);
require_once "Services/MediaObjects/classes/class.ilMediaItem.php";
require_once "Services/COPage/classes/class.ilMediaAliasItem.php";
for ($i = 0; $i < count($res->nodeset); $i++) {
$media_object_node = $res->nodeset[$i]->parent_node();
$page_content_node = $media_object_node->parent_node();
$c_hier_id = $page_content_node->get_attribute("HierId");
// first check, wheter we got instance map areas -> take these
$std_alias_item = new ilMediaAliasItem($this->dom, $c_hier_id, "Standard");
$areas = $std_alias_item->getMapAreas();
$correction_needed = false;
if (count($areas) > 0) {
// check if correction needed
foreach ($areas as $area) {
if ($area["Type"] == "PageObject" || $area["Type"] == "StructureObject") {
$t = $area["Target"];
$tid = _extractObjIdOfTarget($t);
if ($a_from_to[$tid] > 0) {
$correction_needed = true;
}
}
}
} else {
$areas = array();
// get object map areas and check whether at least one must
// be corrected
$oid = $res->nodeset[$i]->get_attribute("OriginId");
if (substr($oid, 0, 4) == "il__") {
$id_arr = explode("_", $oid);
$id = $id_arr[count($id_arr) - 1];
$mob = new ilObjMediaObject($id);
$med_item = $mob->getMediaItem("Standard");
$med_areas = $med_item->getMapAreas();
foreach ($med_areas as $area) {
$link_type = $area->getLinkType() == "int" ? "IntLink" : "ExtLink";
$areas[] = array("Nr" => $area->getNr(), "Shape" => $area->getShape(), "Coords" => $area->getCoords(), "Link" => array("LinkType" => $link_type, "Href" => $area->getHref(), "Title" => $area->getTitle(), "Target" => $area->getTarget(), "Type" => $area->getType(), "TargetFrame" => $area->getTargetFrame()));
if ($area->getType() == "PageObject" || $area->getType() == "StructureObject") {
$t = $area->getTarget();
$tid = ilInternalLink::_extractObjIdOfTarget($t);
if ($a_from_to[$tid] > 0) {
$correction_needed = true;
}
//var_dump($a_from_to);
}
}
}
}
// correct map area links
if ($correction_needed) {
$changed = true;
$std_alias_item->deleteAllMapAreas();
foreach ($areas as $area) {
if ($area["Link"]["LinkType"] == "IntLink") {
$target = $area["Link"]["Target"];
$type = $area["Link"]["Type"];
$obj_id = ilInternalLink::_extractObjIdOfTarget($target);
if ($a_from_to[$obj_id] > 0) {
if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") {
$area["Link"]["Target"] = "il__pg_" . $a_from_to[$obj_id];
}
if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") {
$area["Link"]["Target"] = "il__st_" . $a_from_to[$obj_id];
}
}
}
$std_alias_item->addMapArea($area["Shape"], $area["Coords"], $area["Link"]["Title"], array("Type" => $area["Link"]["Type"], "TargetFrame" => $area["Link"]["TargetFrame"], "Target" => $area["Link"]["Target"], "Href" => $area["Link"]["Href"], "LinkType" => $area["Link"]["LinkType"]));
}
}
}
unset($xpc);
return $changed;
}
示例13: setDefaultLinkXml
/**
* Set standard link xml
*/
function setDefaultLinkXml()
{
global $ilCtrl;
$int_links = $this->getPageObject()->getInternalLinks();
//var_dump($int_links);
$link_info = "<IntLinkInfos>";
$targetframe = "None";
foreach ($int_links as $int_link) {
$target = $int_link["Target"];
if (substr($target, 0, 4) == "il__") {
$target_arr = explode("_", $target);
$target_id = $target_arr[count($target_arr) - 1];
$type = $int_link["Type"];
$targetframe = $int_link["TargetFrame"] != "" ? $int_link["TargetFrame"] : "None";
$ltarget = "_top";
if ($targetframe != "None") {
$ltarget = "_blank";
}
// anchor
$anc = $anc_add = "";
if ($int_link["Anchor"] != "") {
$anc = $int_link["Anchor"];
$anc_add = "_" . rawurlencode($int_link["Anchor"]);
}
$href = "";
switch ($type) {
case "PageObject":
case "StructureObject":
$lm_id = ilLMObject::_lookupContObjID($target_id);
if ($type == "PageObject") {
$href = "./goto.php?target=pg_" . $target_id . $anc_add;
} else {
$href = "./goto.php?target=st_" . $target_id;
}
break;
case "GlossaryItem":
if ($targetframe == "None") {
$targetframe = "Glossary";
}
$href = "./goto.php?target=git_" . $target_id;
break;
case "MediaObject":
$ilCtrl->setParameter($this, "mob_id", $target_id);
//$ilCtrl->setParameter($this, "pg_id", $this->obj->getId());
$href = $ilCtrl->getLinkTarget($this, "displayMedia");
$ilCtrl->setParameter($this, "mob_id", "");
break;
case "WikiPage":
include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
$href = ilWikiPage::getGotoForWikiPageTarget($target_id);
break;
case "RepositoryItem":
$obj_type = ilObject::_lookupType($target_id, true);
$obj_id = ilObject::_lookupObjId($target_id);
$href = "./goto.php?target=" . $obj_type . "_" . $target_id;
break;
}
$anc_par = 'Anchor="' . $anc . '"';
$link_info .= "<IntLinkInfo Target=\"{$target}\" Type=\"{$type}\" " . $anc_par . " " . "TargetFrame=\"{$targetframe}\" LinkHref=\"{$href}\" LinkTarget=\"{$ltarget}\" />";
}
}
$link_info .= "</IntLinkInfos>";
$this->setLinkXML($link_info);
}
示例14: isClickable
function isClickable($a_type, $a_node_id)
{
global $ilUser;
$orig_node_id = $a_node_id;
if ($a_type == "st") {
if (!$this->offlineMode()) {
$a_node = $this->tree->fetchSuccessorNode($a_node_id, "pg");
$a_node_id = $a_node["child"];
if ($a_node_id == 0) {
return false;
}
} else {
// get next activated page
$found = false;
while (!$found) {
$a_node = $this->tree->fetchSuccessorNode($a_node_id, "pg");
$a_node_id = $a_node["child"];
include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
$active = ilLMPage::_lookupActive($a_node_id, $this->lm_obj->getType(), $this->lm_set->get("time_scheduled_page_activation"));
if ($a_node_id > 0 && !$active) {
$found = false;
} else {
$found = true;
}
}
if ($a_node_id <= 0) {
return false;
} else {
$path = $this->tree->getPathId($a_node_id);
if (!in_array($orig_node_id, $path)) {
return false;
}
}
}
}
if ($a_type == "pg") {
// check public area mode
include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
include_once 'Services/Payment/classes/class.ilPaymentObject.php';
if (($ilUser->getId() == ANONYMOUS_USER_ID || ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm_obj->getRefId())) && !ilLMObject::_isPagePublic($a_node_id, true)) {
return false;
}
}
return true;
}
示例15: fillRow
/**
* 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]);
}
//.........这里部分代码省略.........