39 int $a_item_group_ref_id = 0
43 $this->obj_data_cache =
$DIC[
"ilObjDataCache"];
44 $this->log =
$DIC[
"ilLog"];
45 $this->db =
$DIC->database();
46 $this->
lng = $DIC->language();
47 $this->tree =
$DIC->repositoryTree();
48 $this->obj_def =
$DIC[
"objDefinition"];
49 $this->
access = $DIC->access();
63 $this->item_group_id = $a_val;
73 $this->item_group_ref_id = $a_val;
86 $this->items = $a_val;
94 public function addItem(
int $a_item_ref_id): void
96 if (!in_array($a_item_ref_id, $this->items)) {
97 $this->items[] = $a_item_ref_id;
101 public function delete():
void
103 $query =
"DELETE FROM item_group_item " .
104 "WHERE item_group_id = " . $this->db->quote($this->
getItemGroupId(),
'integer');
105 $this->db->manipulate($query);
112 foreach ($this->items as $item) {
113 $query =
"INSERT INTO item_group_item (item_group_id,item_ref_id) " .
116 $this->db->quote($item,
'integer') .
" " .
118 $this->db->manipulate($query);
124 $this->items = array();
125 $set = $this->db->query(
126 "SELECT * FROM item_group_item " .
127 " WHERE item_group_id = " . $this->db->quote($this->getItemGroupId(),
"integer")
129 while ($rec = $this->db->fetchAssoc($set)) {
130 $this->items[] = $rec[
"item_ref_id"];
140 $parent_node = $this->tree->getNodeData(
141 $this->tree->getParentId($this->getItemGroupRefId())
144 $materials = array();
145 $nodes = $this->tree->getChilds($parent_node[
"child"]);
147 foreach ($nodes as $node) {
149 if ($node[
'child'] == $parent_node[
"child"] ||
150 $this->obj_def->isSideBlock($node[
'type']) ||
151 in_array($node[
'type'], array(
'sess',
'itgr',
'rolf',
'adm'))) {
157 if ($node[
'type'] ==
"file" &&
162 if ($this->obj_def->isInactivePlugin((
string) $node[
'type'])) {
166 if (!$this->
access->checkAccess(
'visible',
'', $node[
'ref_id'])) {
170 $materials[] = $node;
182 $valid_items = array();
183 foreach ($ass_items as $aitem) {
184 if (in_array($aitem[
"ref_id"],
$items)) {
185 $valid_items[] = $aitem[
"ref_id"];
197 $ilLog->write(__METHOD__ .
': Begin cloning item group materials ... -' . $a_source_id .
'-');
200 $mappings = $cwo->getMappings();
202 $new_items = array();
205 foreach ($source_ig->getItems() as $item_ref_id) {
206 if (isset($mappings[$item_ref_id]) and $mappings[$item_ref_id]) {
207 $ilLog->write(__METHOD__ .
': Clone item group item nr. ' . $item_ref_id);
208 $new_items[] = $mappings[$item_ref_id];
210 $ilLog->write(__METHOD__ .
': No mapping found for item group item nr. ' . $item_ref_id);
215 $ilLog->write(__METHOD__ .
': Finished cloning item group items ...');
223 $tree =
$DIC->repositoryTree();
227 foreach ($itgr_nodes as $node) {
228 $itgr_ids[] = $node[
'obj_id'];
230 $query =
"SELECT item_ref_id FROM item_group_item " .
231 "WHERE " .
$ilDB->in(
'item_group_id', $itgr_ids,
false,
'integer');
237 $items[] = $row->item_ref_id;
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
static _getInstance(int $a_copy_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setItemGroupId(int $a_val)
cloneItems(int $a_source_id, int $a_copy_id)
ilObjectDefinition $obj_def
__construct(int $a_item_group_ref_id=0)
static _getItemsOfContainer(int $a_ref_id)
setItemGroupRefId(int $a_val)
ilObjectDataCache $obj_data_cache
addItem(int $a_item_ref_id)
Component logger with individual log levels by component id.
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user.
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupObjId(int $ref_id)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...