5require_once 
"Services/Tracking/classes/collection/class.ilLPCollection.php";
 
   22        global $tree, $objDefinition;
 
   24        $cache_idx = $a_ref_id . 
"__" . $a_full_data;
 
   26        if (!isset(self::$possible_items[$cache_idx])) {
 
   27            $all_possible = array();
 
   29            if (!$tree->isDeleted($a_ref_id)) {
 
   30                include_once 
'Services/Repository/classes/class.ilRepositoryObjectPluginSlot.php';
 
   33                    $data = $tree->getRbacSubTreeInfo($a_ref_id);
 
   35                    $node = $tree->getNodeData($a_ref_id);
 
   36                    $data = $tree->getSubTree($node);
 
   38                foreach (
$data as $node) {
 
   40                        $item_ref_id = $node[
'child'];
 
   42                        $item_ref_id = $node[
'ref_id'];
 
   46                    if ($item_ref_id == $a_ref_id ||
 
   51                    switch ($node[
'type']) {
 
   66                                $all_possible[] = $item_ref_id;
 
   68                                $all_possible[$item_ref_id] = array(
 
   69                                    'ref_id' => $item_ref_id,
 
   70                                    'obj_id' => $node[
'obj_id'],
 
   71                                    'title' => $node[
'title'],
 
   72                                    'description' => $node[
'description'],
 
   73                                    'type' => $node[
'type']
 
   79                        case $objDefinition->isPluginTypeName($node[
'type']):
 
   86                                    $all_possible[] = $item_ref_id;
 
   88                                    $all_possible[$item_ref_id] = array(
 
   89                                        'ref_id' => $item_ref_id,
 
   90                                        'obj_id' => $node[
'obj_id'],
 
   91                                        'title' => $node[
'title'],
 
   92                                        'description' => $node[
'description'],
 
   93                                        'type' => $node[
'type']
 
  102            self::$possible_items[$cache_idx] = $all_possible;
 
  105        return self::$possible_items[$cache_idx];
 
  115        if ($a_item_type == 
'tst') {
 
  119            if ($olp->isAnonymized()) {
 
  128        parent::cloneCollection($a_target_id, $a_copy_id);
 
  130        include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
 
  132        $mappings = $cwo->getMappings();
 
  135        $target_collection = 
new static($target_obj_id, 
$this->mode);
 
  139            $target_item_ids = array();
 
  140            foreach ($group[
"items"] as $item) {
 
  141                if (!isset($mappings[$item]) or !$mappings[$item]) {
 
  145                $target_item_ids[] = $mappings[$item];
 
  149            if ($grouping_id && 
sizeof($target_item_ids) > 1) {
 
  151                $num_obligatory = min(
sizeof($target_item_ids), $group[
"num_obligatory"]);
 
  153                $target_collection->createNewGrouping($target_item_ids, $num_obligatory);
 
  156                foreach ($target_item_ids as $item_id) {
 
  168    protected function read($a_obj_id)
 
  175        $ref_id = end($ref_ids);
 
  178        $res = 
$ilDB->query(
"SELECT utc.item_id, obd.type" .
 
  179            " FROM ut_lp_collections utc" .
 
  180            " JOIN object_reference obr ON item_id = ref_id" .
 
  181            " JOIN object_data obd ON obr.obj_id = obd.obj_id" .
 
  182            " WHERE utc.obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  183            " AND active = " . 
$ilDB->quote(1, 
"integer") .
 
  186            if (in_array(
$row->item_id, $possible) &&
 
  187                $this->validateEntry(
$row->item_id, 
$row->type)) {
 
  206            $query = 
"INSERT INTO ut_lp_collections" .
 
  207                " (obj_id, lpmode, item_id, grouping_id, num_obligatory, active)" .
 
  208                " VALUES (" . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  209                ", " . 
$ilDB->quote($this->mode, 
"integer") .
 
  210                ", " . 
$ilDB->quote($a_item_id, 
"integer") .
 
  211                ", " . 
$ilDB->quote(0, 
"integer") .
 
  212                ", " . 
$ilDB->quote(0, 
"integer") .
 
  213                ", " . 
$ilDB->quote(1, 
"integer") .
 
  216            $this->items[] = $a_item_id;
 
  225        $query = 
"DELETE FROM ut_lp_collections " .
 
  226            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  227            " AND item_id = " . 
$ilDB->quote($a_item_id, 
"integer") .
 
  228            " AND grouping_id = " . 
$ilDB->quote(0, 
"integer");
 
  242        $query = 
"SELECT item_id FROM ut_lp_collections" .
 
  243            " WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer") .
 
  244            " AND grouping_id > " . 
$ilDB->quote(0, 
"integer");
 
  246        return $res->numRows() ? true : 
false;
 
  253        $grouping_ids = array();
 
  255        $query = 
"SELECT grouping_id FROM ut_lp_collections" .
 
  256            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  257            " AND " . 
$ilDB->in(
"item_id", $a_item_ids, 
false, 
"integer") .
 
  258            " AND grouping_id > " . 
$ilDB->quote(0, 
"integer");
 
  261            $grouping_ids[] = 
$row->grouping_id;
 
  264        return $grouping_ids;
 
  271        parent::deactivateEntries($a_item_ids);
 
  275            $query = 
"UPDATE ut_lp_collections" .
 
  276                " SET active = " . 
$ilDB->quote(0, 
"integer") .
 
  277                " WHERE " . 
$ilDB->in(
"grouping_id", $grouping_ids, 
false, 
"integer") .
 
  278                " AND obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer");
 
  287        parent::activateEntries($a_item_ids);
 
  291            $query = 
"UPDATE ut_lp_collections" .
 
  292                " SET active = " . 
$ilDB->quote(1, 
"integer") .
 
  293                " WHERE " . 
$ilDB->in(
"grouping_id", $grouping_ids, 
false, 
"integer") .
 
  294                " AND obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer");
 
  305        $all_item_ids = array();
 
  309        $query = 
"SELECT item_id FROM ut_lp_collections" .
 
  310            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  311            " AND " . 
$ilDB->in(
"grouping_id", $grouping_ids, 
false, 
"integer");
 
  314            $all_item_ids[] = 
$row->item_id;
 
  317        $all_item_ids = array_unique(array_merge($all_item_ids, $a_item_ids));
 
  322        $query = 
"SELECT MAX(grouping_id) grp FROM ut_lp_collections" .
 
  323            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  330        $query = 
"UPDATE ut_lp_collections SET" .
 
  331            " grouping_id = " . 
$ilDB->quote($grp_id, 
"integer") .
 
  332            ", num_obligatory = " . 
$ilDB->quote($a_num_obligatory, 
"integer") .
 
  333            ", active = " . 
$ilDB->quote(1, 
"integer") .
 
  334            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  335            " AND " . 
$ilDB->in(
"item_id", $all_item_ids, 
false, 
"integer");
 
  347        $query = 
"UPDATE ut_lp_collections" .
 
  348            " SET grouping_id = " . 
$ilDB->quote(0, 
"integer") .
 
  349            ", num_obligatory = " . 
$ilDB->quote(0, 
"integer") .
 
  350            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  351            " AND " . 
$ilDB->in(
"grouping_id", $grouping_ids, 
false, 
"integer");
 
  359        foreach ($a_obl as $grouping_id => $num) {
 
  360            $query = 
"SELECT count(obj_id) num FROM ut_lp_collections" .
 
  361                " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  362                " AND grouping_id = " . 
$ilDB->quote($grouping_id, 
'integer') .
 
  366                if ($num <= 0 || $num >= 
$row->num) {
 
  367                    throw new UnexpectedValueException();
 
  371        foreach ($a_obl as $grouping_id => $num) {
 
  372            $query = 
"UPDATE ut_lp_collections" .
 
  373                " SET num_obligatory = " . 
$ilDB->quote($num, 
"integer") .
 
  374                " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  375                " AND grouping_id = " . 
$ilDB->quote($grouping_id, 
"integer");
 
  391        foreach (
$items as $item_id => $item) {
 
  392            if (in_array($item_id, $done)) {
 
  399            $table_item[
'grouped'] = array();
 
  401            if (count((array) $grouped_items[
'items']) > 1) {
 
  402                foreach ($grouped_items[
'items'] as $grouped_item_id) {
 
  403                    if ($grouped_item_id == $item_id ||
 
  404                        !is_array(
$items[$grouped_item_id])) { 
 
  409                    $table_item[
'num_obligatory'] = $grouped_items[
'num_obligatory'];
 
  410                    $table_item[
'grouping_id'] = $grouped_items[
'grouping_id'];
 
  412                    $done[] = $grouped_item_id;
 
  416            $data[] = $table_item;
 
  424        $table_item = $a_item;
 
  425        $table_item[
'id'] = $a_id;
 
  429        $table_item[
'mode_id'] = $olp->getCurrentMode();
 
  430        $table_item[
'mode'] = $olp->getModeText($table_item[
'mode_id']);
 
  431        $table_item[
'anonymized'] = $olp->isAnonymized();
 
  442        $query = 
"SELECT grouping_id FROM ut_lp_collections" .
 
  443            " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  444            " AND item_id = " . 
$ilDB->quote($item_id, 
"integer");
 
  447        $grouping_id = 
$row->grouping_id;
 
  448        if ($grouping_id > 0) {
 
  449            $query = 
"SELECT item_id, num_obligatory FROM ut_lp_collections" .
 
  450                " WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
"integer") .
 
  451                " AND grouping_id = " . 
$ilDB->quote($grouping_id, 
"integer");
 
  455                $items[
'num_obligatory'] = 
$row->num_obligatory;
 
  456                $items[
'grouping_id'] = $grouping_id;
 
  469        $query = 
" SELECT * FROM ut_lp_collections" .
 
  470            " WHERE obj_id = " . $ilDB->quote($this->obj_id, 
"integer") .
 
  471            " AND active = " . 
$ilDB->quote(1, 
"integer");
 
  477                $grouped[
$row->grouping_id][
'items'][] = 
$row->item_id;
 
  478                $grouped[
$row->grouping_id][
'num_obligatory'] = 
$row->num_obligatory;
 
An exception for terminatinating execution or to throw for unit testing.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
LP collection of repository objects.
releaseGrouping(array $a_item_ids)
parseTableGUIItem($a_id, array $a_item)
getGroupedItemsForLPStatus()
cloneCollection($a_target_id, $a_copy_id)
getTableGUIData($a_parent_ref_id)
deactivateEntries(array $a_item_ids)
static hasGroupedItems($a_obj_id)
validateEntry($a_item_ref_id, $a_item_type=null)
getTableGUItemGroup($item_id)
getGroupingIds(array $a_item_ids)
createNewGrouping(array $a_item_ids, $a_num_obligatory=1)
getPossibleItems($a_ref_id, $a_full_data=false)
saveObligatoryMaterials(array $a_obl)
activateEntries(array $a_item_ids)
LP collection base class.
isAssignedEntry($a_item_id)
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
static isTypePluginWithLP($a_type, $a_active_status=true)
Check whether a repository type is a plugin which has active learning progress.
foreach($_POST as $key=> $value) $res