protected function initPlugin()
 {
     // active plugin?
     include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
     if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id))) {
         $obj = ilObjectFactory::getInstanceByObjId($this->obj_id);
         if ($obj && $obj instanceof ilLPStatusPluginInterface) {
             $this->status = $obj;
         }
     } else {
         if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($this->obj_id), false)) {
             $this->status = self::INACTIVE_PLUGIN;
         }
     }
 }
 /**
  * Get ilObjectPlugin for object id
  * 
  * @param int $a_obj_id
  * @return ilObjectPlugin
  */
 protected static function initPluginObj($a_obj_id)
 {
     if (!isset(self::$plugins[$a_obj_id])) {
         self::$plugins[$a_obj_id] = false;
         // active plugin?
         include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
         if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($a_obj_id))) {
             $obj = ilObjectFactory::getInstanceByObjId($a_obj_id);
             if ($obj && $obj instanceof ilLPStatusPluginInterface) {
                 self::$plugins[$a_obj_id] = $obj;
             }
         } else {
             if (ilRepositoryObjectPluginSlot::isTypePluginWithLP(ilObject::_lookupType($a_obj_id), false)) {
                 self::$plugins[$a_obj_id] = self::INACTIVE_PLUGIN;
             }
         }
     }
     return self::$plugins[$a_obj_id];
 }
 public function getPossibleItems($a_ref_id, $a_full_data = false)
 {
     global $tree, $objDefinition;
     $cache_idx = $a_ref_id . "__" . $a_full_data;
     if (!isset(self::$possible_items[$cache_idx])) {
         $all_possible = array();
         if (!$tree->isDeleted($a_ref_id)) {
             include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
             if (!$a_full_data) {
                 $data = $tree->getRbacSubTreeInfo($a_ref_id);
             } else {
                 $node = $tree->getNodeData($a_ref_id);
                 $data = $tree->getSubTree($node);
             }
             foreach ($data as $node) {
                 if (!$a_full_data) {
                     $item_ref_id = $node['child'];
                 } else {
                     $item_ref_id = $node['ref_id'];
                 }
                 // avoid recursion
                 if ($item_ref_id == $a_ref_id || !$this->validateEntry($item_ref_id, $node['type'])) {
                     continue;
                 }
                 switch ($node['type']) {
                     case 'sess':
                     case 'exc':
                     case 'fold':
                     case 'grp':
                     case 'sahs':
                     case 'lm':
                     case 'tst':
                     case 'htlm':
                         if (!$a_full_data) {
                             $all_possible[] = $item_ref_id;
                         } else {
                             $all_possible[$item_ref_id] = array('ref_id' => $item_ref_id, 'obj_id' => $node['obj_id'], 'title' => $node['title'], 'description' => $node['description'], 'type' => $node['type']);
                         }
                         break;
                         // repository plugin object?
                     // repository plugin object?
                     case $objDefinition->isPluginTypeName($node['type']):
                         $only_active = false;
                         if (!$this->isAssignedEntry($item_ref_id)) {
                             $only_active = true;
                         }
                         if (ilRepositoryObjectPluginSlot::isTypePluginWithLP($node['type'], $only_active)) {
                             if (!$a_full_data) {
                                 $all_possible[] = $item_ref_id;
                             } else {
                                 $all_possible[$item_ref_id] = array('ref_id' => $item_ref_id, 'obj_id' => $node['obj_id'], 'title' => $node['title'], 'description' => $node['description'], 'type' => $node['type']);
                             }
                         }
                         break;
                 }
             }
         }
         self::$possible_items[$cache_idx] = $all_possible;
     }
     return self::$possible_items[$cache_idx];
 }
 /**
  * Get possible subtypes
  *
  * @param bool $a_split_learning_resources
  * @param bool $a_include_digilib
  * @param bool $a_allow_undefined_lp
  */
 protected function getPossibleTypes($a_split_learning_resources = false, $a_include_digilib = false, $a_allow_undefined_lp = false)
 {
     global $lng, $ilPluginAdmin;
     $options = array();
     if ($a_split_learning_resources) {
         $options['lm'] = $lng->txt('objs_lm');
         $options['sahs'] = $lng->txt('objs_sahs');
         $options['htlm'] = $lng->txt('objs_htlm');
         if ($a_include_digilib) {
             $options['dbk'] = $lng->txt('objs_dbk');
         }
     } else {
         $options['lres'] = $lng->txt('learning_resources');
     }
     $options['crs'] = $lng->txt('objs_crs');
     $options['grp'] = $lng->txt('objs_grp');
     $options['exc'] = $lng->txt('objs_exc');
     $options['tst'] = $lng->txt('objs_tst');
     if ($a_allow_undefined_lp) {
         $options["file"] = $lng->txt("objs_file");
         $options["webr"] = $lng->txt("objs_webr");
         $options["wiki"] = $lng->txt("objs_wiki");
     }
     // repository plugins (currently only active)
     include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "Repository", "robj");
     foreach ($pl_names as $pl) {
         $pl_id = $ilPluginAdmin->getId(IL_COMP_SERVICE, "Repository", "robj", $pl);
         if (ilRepositoryObjectPluginSlot::isTypePluginWithLP($pl_id)) {
             $options[$pl_id] = ilPlugin::lookupTxt("rep_robj", $pl_id, "objs_" . $pl_id);
         }
     }
     asort($options);
     return $options;
 }
 function getItems()
 {
     include_once "Services/Tracking/classes/class.ilTrQuery.php";
     $res = ilTrQuery::getObjectTypeStatisticsPerMonth($this->filter["aggregation"], $this->filter["year"]);
     // get plugin titles
     include_once "./Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php";
     $plugins = array();
     $plugins = ilRepositoryObjectPluginSlot::addCreatableSubObjects($plugins);
     $data = array();
     foreach ($res as $type => $months) {
         $data[$type]["type"] = $type;
         // to enable sorting by title
         if (array_key_exists($type, $plugins)) {
             include_once "./Services/Component/classes/class.ilPlugin.php";
             $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
             $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
         } else {
             $data[$type]["title"] = $this->lng->txt("objs_" . $type);
             $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
         }
         foreach ($months as $month => $row) {
             $value = $row[$this->filter["measure"]];
             $data[$type]["month_" . $month] = $value;
         }
     }
     // add live data
     if ($this->filter["year"] == date("Y")) {
         $live = ilTrQuery::getObjectTypeStatistics();
         foreach ($live as $type => $item) {
             $data[$type]["type"] = $type;
             // to enable sorting by title
             if (array_key_exists($type, $plugins)) {
                 include_once "./Services/Component/classes/class.ilPlugin.php";
                 $data[$type]["title"] = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type);
                 $data[$type]["icon"] = ilObject::_getIcon("", "tiny", $type);
             } else {
                 $data[$type]["title"] = $this->lng->txt("objs_" . $type);
                 $data[$type]["icon"] = ilUtil::getTypeIconPath($type, null, "tiny");
             }
             $value = $item[$this->filter["measure"]];
             $data[$type]["month_live"] = $value;
         }
     }
     $this->setData($data);
 }
 public static function _getPossibleItems($a_target_id, $a_collection = null)
 {
     global $tree;
     if ($tree->isDeleted($a_target_id)) {
         return array();
     }
     include_once 'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
     $plugin_types = array();
     $node_data = $tree->getNodeData($a_target_id);
     foreach ($tree->getSubTree($node_data) as $node) {
         // avoid recursion
         if ($node['ref_id'] == $a_target_id) {
             continue;
         }
         switch ($node['type']) {
             case 'sess':
             case 'exc':
             case 'fold':
             case 'grp':
             case 'sahs':
             case 'lm':
             case 'tst':
             case 'htlm':
                 $all_possible[] = $node['ref_id'];
                 break;
             default:
                 // repository plugin object?
                 $only_active = false;
                 if ($a_collection && !$a_collection->isAssigned($node['ref_id'])) {
                     $only_active = true;
                 }
                 if (ilRepositoryObjectPluginSlot::isTypePluginWithLP($node['type'], $only_active)) {
                     $all_possible[] = $node['ref_id'];
                 }
                 break;
         }
     }
     return $all_possible ? $all_possible : array();
 }