/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $obj_id = $a_set["obj_id"]; $ref_id = $a_set["ref_id"]; $type = $a_set['type']; $title = $a_set['title']; $description = $a_set['description']; $relevance = $a_set['relevance']; if (!$type) { return false; } include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php'; $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type); $item_list_gui->initItem($ref_id, $obj_id, $title, $description); $item_list_gui->setContainerObject($this->parent_obj); $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id, 0)); $item_list_gui->setSeparateCommands(true); ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_set); $this->presenter->appendAdditionalInformation($item_list_gui, $ref_id, $obj_id, $type); $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML()); if ($html = $item_list_gui->getListItemHTML($ref_id, $obj_id, $title, $description)) { $item_html[$ref_id]['html'] = $html; $item_html[$ref_id]['type'] = $type; } $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]); global $lng; if ($this->enabledRelevance()) { $width1 = (int) ((int) $relevance / 2); $width2 = (int) (50 - $width1); $this->tpl->setCurrentBlock('relev'); $this->tpl->setVariable('VAL_REL', sprintf("%d %%", $relevance)); $this->tpl->setVariable('WIDTH_A', $width1); $this->tpl->setVariable('WIDTH_B', $width2); $this->tpl->setVariable('IMG_A', ilUtil::getImagePath("relevance_blue.png")); $this->tpl->setVariable('IMG_B', ilUtil::getImagePath("relevance_dark.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ITEM_HTML", $html); if (!$objDefinition->isPlugin($type)) { $type_txt = $lng->txt('icon') . ' ' . $lng->txt('obj_' . $type); $icon = ilUtil::getImagePath('icon_' . $type . '.png'); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } $this->tpl->setVariable("TYPE_IMG", ilUtil::img($icon, $type_txt)); }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $obj_id = $a_set["obj_id"]; $ref_id = $a_set["ref_id"]; $type = $a_set['type']; $title = $a_set['title']; $description = $a_set['description']; $relevance = $a_set['relevance']; if (!$type) { return false; } include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php'; $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type); $item_list_gui->initItem($ref_id, $obj_id, $title, $description); $item_list_gui->setContainerObject($this->parent_obj); $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id, 0)); $item_list_gui->setSeparateCommands(true); ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_set); $this->presenter->appendAdditionalInformation($item_list_gui, $ref_id, $obj_id, $type); $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML()); if ($html = $item_list_gui->getListItemHTML($ref_id, $obj_id, $title, $description)) { $item_html[$ref_id]['html'] = $html; $item_html[$ref_id]['type'] = $type; } $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]); global $lng; if ($this->enabledRelevance()) { include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php"; $pbar = ilProgressBar::getInstance(); $pbar->setCurrent($relevance); $this->tpl->setCurrentBlock('relev'); $this->tpl->setVariable('REL_PBAR', $pbar->render()); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ITEM_HTML", $html); if (!$objDefinition->isPlugin($type)) { $type_txt = $lng->txt('icon') . ' ' . $lng->txt('obj_' . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } $this->tpl->setVariable("TYPE_IMG", ilUtil::img($icon, $type_txt, '', '', 0, '', 'ilIcon')); }
/** * Render an item * * @param array item data * * @return string item HTML */ function renderItem($a_item_data, $a_position = 0, $a_force_icon = false, $a_pos_prefix = "") { global $ilSetting, $ilAccess, $ilCtrl; // Pass type, obj_id and tree to checkAccess method to improve performance if (!$ilAccess->checkAccess('visible', '', $a_item_data['ref_id'], $a_item_data['type'], $a_item_data['obj_id'], $a_item_data['tree'])) { return ''; } $item_list_gui = $this->getItemGUI($a_item_data); if ($ilSetting->get("icon_position_in_lists") == "item_rows" || $a_item_data["type"] == "sess" || $a_force_icon) { $item_list_gui->enableIcon(true); } if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) { $item_list_gui->enableCheckbox(true); } else { if ($this->getContainerGUI()->isMultiDownloadEnabled()) { // display multi download checkboxes $item_list_gui->enableDownloadCheckbox($a_item_data["ref_id"], true); } } if ($this->getContainerGUI()->isActiveItemOrdering() && ($a_item_data['type'] != 'sess' || get_class($this) != 'ilContainerSessionsContentGUI')) { $item_list_gui->setPositionInputField($a_pos_prefix . "[" . $a_item_data["ref_id"] . "]", sprintf('%d', (int) $a_position * 10)); } if ($a_item_data['type'] == 'sess' and get_class($this) != 'ilContainerObjectiveGUI') { switch ($this->getDetailsLevel($a_item_data['obj_id'])) { case self::DETAILS_TITLE: $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_MINIMAL); $item_list_gui->enableExpand(true); $item_list_gui->setExpanded(false); $item_list_gui->enableDescription(false); $item_list_gui->enableProperties(true); break; case self::DETAILS_ALL: $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL); $item_list_gui->enableExpand(true); $item_list_gui->setExpanded(true); $item_list_gui->enableDescription(true); $item_list_gui->enableProperties(true); break; default: $item_list_gui->setDetailsLevel(ilObjectListGUI::DETAILS_ALL); $item_list_gui->enableExpand(true); $item_list_gui->enableDescription(true); $item_list_gui->enableProperties(true); break; } } if (method_exists($this, "addItemDetails")) { $this->addItemDetails($item_list_gui, $a_item_data); } // show subitems if ($a_item_data['type'] == 'sess' and ($this->getDetailsLevel($a_item_data['obj_id']) != self::DETAILS_TITLE or $this->getContainerGUI()->isActiveAdministrationPanel() or $this->getContainerGUI()->isActiveItemOrdering())) { $pos = 1; include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByEvent($a_item_data['obj_id']); $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('sess', $a_item_data['obj_id'], $items); $item_readable = $ilAccess->checkAccess('read', '', $a_item_data['ref_id']); foreach ($items as $item) { // TODO: this should be removed and be handled by if(strlen($sub_item_html)) // see mantis: 0003944 if (!$ilAccess->checkAccess('visible', '', $item['ref_id'])) { continue; } $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); $item_list_gui2->enableItemDetailLinks(false); // unique js-ids $item_list_gui2->setParentRefId($a_item_data['ref_id']); // @see mantis 10488 if (!$item_readable and !$ilAccess->checkAccess('write', '', $item['ref_id'])) { $item_list_gui2->forceVisibleOnly(true); } if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) { $item_list_gui2->enableCheckbox(true); } else { if ($this->getContainerGUI()->isMultiDownloadEnabled()) { // display multi download checkbox $item_list_gui2->enableDownloadCheckbox($item['ref_id'], true); } } if ($this->getContainerGUI()->isActiveItemOrdering()) { $item_list_gui2->setPositionInputField("[sess][" . $a_item_data['obj_id'] . "][" . $item["ref_id"] . "]", sprintf('%d', (int) $pos * 10)); $pos++; } // #10611 ilObjectActivation::addListGUIActivationProperty($item_list_gui2, $item); $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded()); if (strlen($sub_item_html)) { $item_list_gui->addSubItemHTML($sub_item_html); } } } if ($ilSetting->get("item_cmd_asynch")) { $asynch = true; $ilCtrl->setParameter($this->container_gui, "cmdrefid", $a_item_data['ref_id']); $asynch_url = $ilCtrl->getLinkTarget($this->container_gui, "getAsynchItemList", "", true, false); $ilCtrl->setParameter($this->container_gui, "cmdrefid", ""); } include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_item_data); $html = $item_list_gui->getListItemHTML($a_item_data['ref_id'], $a_item_data['obj_id'], $a_item_data['title'], $a_item_data['description'], $asynch, false, $asynch_url); $this->determineAdminCommands($a_item_data["ref_id"], $item_list_gui->adminCommandsIncluded()); return $html; }
/** * get selected items per type */ function getSelectedItemsPerLocation(&$tpl) { global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree; $output = false; $items = $ilUser->getDesktopItems(); $item_html = array(); $cur_obj_type = ""; if (count($items) > 0) { // preload object data cache $ref_ids = $obj_ids = array(); foreach ($items as $item) { $ref_ids[] = $item["ref_id"]; $obj_ids[] = $item["obj_id"]; } reset($items); $tree->preloadDeleted($ref_ids); $tree->preloadDepthParent($ref_ids); $ilObjDataCache->preloadReferenceCache($ref_ids); include_once "Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($obj_ids); include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($ref_ids); foreach ($items as $item) { //echo "1"; // get list gui class for each object type if ($cur_obj_type != $item["type"]) { $item_list_gui =& $this->getItemListGUI($item["type"]); if (!$item_list_gui) { continue; } ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item); // notes, comment currently do not work properly $item_list_gui->enableNotes(false); $item_list_gui->enableComments(false); $item_list_gui->enableTags(false); $item_list_gui->enableIcon(true); $item_list_gui->enableDelete(false); $item_list_gui->enableCut(false); $item_list_gui->enableCopy(false); $item_list_gui->enablePayment(false); $item_list_gui->enableLink(false); $item_list_gui->enableInfoScreen(true); if ($this->getCurrentDetailLevel() < 3 || $this->manage) { //echo "3"; $item_list_gui->enableDescription(false); $item_list_gui->enableProperties(false); $item_list_gui->enablePreconditions(false); } if ($this->getCurrentDetailLevel() < 2 || $this->manage) { $item_list_gui->enableCommands(true, true); } } // render item row $ilBench->start("ilPersonalDesktopGUI", "getListHTML"); $item_list_gui->setContainerObject($this); $html = $item_list_gui->getListItemHTML($item["ref_id"], $item["obj_id"], $item["title"], $item["description"]); $ilBench->stop("ilPersonalDesktopGUI", "getListHTML"); if ($html != "") { // BEGIN WebDAV: Use $item_list_gui to determine icon image type $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"], "item_obj_id" => $item["obj_id"], "parent_ref" => $item["parent_ref"], "type" => $item["type"], 'item_icon_image_type' => $item_list_gui->getIconImageType()); // END WebDAV: Use $item_list_gui to determine icon image type } } // output block for resource type if (count($item_html) > 0) { $cur_parent_ref = 0; // content row foreach ($item_html as $item) { // add a parent header row for each new parent if ($cur_parent_ref != $item["parent_ref"]) { if ($ilSetting->get("icon_position_in_lists") == "item_rows") { $this->addParentRow($tpl, $item["parent_ref"], false); } else { $this->addParentRow($tpl, $item["parent_ref"]); } $this->resetRowType(); $cur_parent_ref = $item["parent_ref"]; } // BEGIN WebDAV: Use $item_list_gui to determine icon image type. $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $item['item_icon_image_type'], "th_" . $cur_parent_ref); // END WebDAV: Use $item_list_gui to determine icon image type. $output = true; } } } return $output; }
/** * Modify Item ListGUI for presentation in container */ function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path) { global $tree; // if folder is in a course, modify item list gui according to course requirements if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) { // #10611 include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data); include_once "./Modules/Course/classes/class.ilObjCourse.php"; include_once "./Modules/Course/classes/class.ilObjCourseGUI.php"; $course_obj_id = ilObject::_lookupObjId($course_ref_id); ilObjCourseGUI::_modifyItemGUI($a_item_list_gui, get_class($this), $a_item_data, $a_show_path, ilObjCourse::_lookupAboStatus($course_obj_id), $course_ref_id, $course_obj_id, $this->object->getRefId()); } }