/**
  * 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;
 }
 /**
  * Render item list 
  * @return void
  */
 protected function renderItemList()
 {
     global $tree, $ilBench;
     $this->html = '';
     $ilBench->start('Lucene', '2000_pr');
     $item_html = array();
     $this->parseResultReferences();
     $ilBench->stop('Lucene', '2000_pr');
     $set = $obj_ids = array();
     foreach ($this->getResults() as $c_ref_id => $res_data) {
         $ilBench->start('Lucene', '2100_res');
         foreach ($this->getAllReferences($c_ref_id) as $ref_id) {
             $ilBench->start('Lucene', '2120_tree');
             if (!$tree->isInTree($ref_id)) {
                 continue;
             }
             $ilBench->stop('Lucene', '2120_tree');
             $set[] = array("ref_id" => $ref_id, "obj_id" => $res_data, "title" => $this->lookupTitle($res_data, 0), "title_sort" => ilObject::_lookupTitle($res_data), "description" => $this->lookupDescription($res_data, 0), "type" => ilObject::_lookupType($res_data), "relevance" => $this->getRelevance($res_data), "s_relevance" => sprintf("%03d", $this->getRelevance($res_data)));
             $obj_ids[] = $res_data;
         }
         $ilBench->stop('Lucene', '2100_res');
     }
     if (!count($set)) {
         return false;
     }
     include_once "Services/Tracking/classes/class.ilLPStatus.php";
     ilLPStatus::preloadListGUIData($obj_ids);
     $ilBench->start('Lucene', '2900_tb');
     include_once "./Services/Search/classes/class.ilSearchResultTableGUI.php";
     $result_table = new ilSearchResultTableGUI($this->container, "showSavedResults", $this);
     $result_table->setCustomPreviousNext($this->prev, $this->next);
     $result_table->setData($set);
     $this->thtml = $result_table->getHTML();
     $ilBench->stop('Lucene', '2900_tb');
     return true;
 }
 public function preload()
 {
     global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem;
     if (!$this->obj_ids) {
         return;
     }
     $this->obj_ids = array_unique($this->obj_ids);
     $this->types = array_unique($this->types);
     if ($this->ref_ids) {
         $this->ref_ids = array_unique($this->ref_ids);
     }
     // type specific preloads
     include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
     foreach ($this->types as $type) {
         $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]);
         if (is_array($this->ref_ids_by_type[$type])) {
             $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]);
         }
         if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
             ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]);
         }
         $class = $objDefinition->getClassName($type);
         $location = $objDefinition->getLocation($type);
         if ($class && $location) {
             $full_class = "ilObj" . $class . "Access";
             include_once $location . "/class." . $full_class . ".php";
             if (class_exists($full_class)) {
                 call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]);
             }
         }
     }
     if ($this->ref_ids) {
         $tree->preloadDeleted($this->ref_ids);
         $tree->preloadDepthParent($this->ref_ids);
         $ilObjDataCache->preloadReferenceCache($this->ref_ids, false);
         $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId());
         if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) {
             ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids);
         }
         include_once "./Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::preloadData($this->ref_ids);
     }
     include_once "./Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context);
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) {
         include_once "./Services/Rating/classes/class.ilRating.php";
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         ilRating::preloadListGUIData($this->obj_ids);
         include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php";
         ilAdvancedMDValues::preloadByObjIds($this->obj_ids);
     }
     if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) {
         include_once "./Services/Tracking/classes/class.ilLPStatus.php";
         ilLPStatus::preloadListGUIData($this->obj_ids);
     }
 }
 /**
  * Preload common properties
  *
  * @param
  * @return
  */
 static function preloadCommonProperties($a_obj_ids)
 {
     global $lng;
     $lng->loadLanguageModule("notes");
     $lng->loadLanguageModule("tagging");
     $lng->loadLanguageModule("rating");
     include_once "./Services/Tagging/classes/class.ilTagging.php";
     self::$cnt_tags = ilTagging::_countTags($a_obj_ids);
     include_once "./Services/Notes/classes/class.ilNote.php";
     self::$cnt_notes = ilNote::_countNotesAndCommentsMultiple($a_obj_ids, true);
     self::$comments_activation = ilNote::getRepObjActivation($a_obj_ids);
     include_once "./Services/Tracking/classes/class.ilLPStatus.php";
     ilLPStatus::preloadListGUIData($a_obj_ids);
     include_once "./Services/Rating/classes/class.ilRating.php";
     include_once "./Services/Rating/classes/class.ilRatingGUI.php";
     ilRating::preloadListGUIData($a_obj_ids);
     self::$preload_done = true;
 }