38 int $a_item_group_ref_id = 0
42 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
43 $this->log = $DIC[
"ilLog"];
44 $this->db = $DIC->database();
45 $this->
lng = $DIC->language();
46 $this->tree = $DIC->repositoryTree();
47 $this->obj_def = $DIC[
"objDefinition"];
61 $this->item_group_id = $a_val;
71 $this->item_group_ref_id = $a_val;
84 $this->items = $a_val;
92 public function addItem(
int $a_item_ref_id): void
94 if (!in_array($a_item_ref_id, $this->items)) {
95 $this->items[] = $a_item_ref_id;
99 public function delete():
void 101 $query =
"DELETE FROM item_group_item " .
102 "WHERE item_group_id = " . $this->db->quote($this->
getItemGroupId(),
'integer');
103 $this->db->manipulate($query);
110 foreach ($this->items as $item) {
111 $query =
"INSERT INTO item_group_item (item_group_id,item_ref_id) " .
114 $this->db->quote($item,
'integer') .
" " .
116 $this->db->manipulate($query);
122 $this->items = array();
123 $set = $this->db->query(
124 "SELECT * FROM item_group_item " .
125 " WHERE item_group_id = " . $this->db->quote($this->getItemGroupId(),
"integer")
127 while ($rec = $this->db->fetchAssoc($set)) {
128 $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 ($objDefinition->isInactivePlugin((
string) $node[
'type'])) {
166 $materials[] = $node;
178 $valid_items = array();
179 foreach ($ass_items as $aitem) {
180 if (in_array($aitem[
"ref_id"], $items)) {
181 $valid_items[] = $aitem[
"ref_id"];
193 $ilLog->
write(__METHOD__ .
': Begin cloning item group materials ... -' . $a_source_id .
'-');
196 $mappings = $cwo->getMappings();
198 $new_items = array();
201 foreach ($source_ig->getItems() as $item_ref_id) {
202 if (isset($mappings[$item_ref_id]) and $mappings[$item_ref_id]) {
203 $ilLog->write(__METHOD__ .
': Clone item group item nr. ' . $item_ref_id);
204 $new_items[] = $mappings[$item_ref_id];
206 $ilLog->write(__METHOD__ .
': No mapping found for item group item nr. ' . $item_ref_id);
211 $ilLog->write(__METHOD__ .
': Finished cloning item group items ...');
218 $ilDB = $DIC->database();
219 $tree = $DIC->repositoryTree();
223 foreach ($itgr_nodes as $node) {
224 $itgr_ids[] = $node[
'obj_id'];
226 $query =
"SELECT item_ref_id FROM item_group_item " .
227 "WHERE " .
$ilDB->in(
'item_group_id', $itgr_ids,
false,
'integer');
233 $items[] = $row->item_ref_id;
setItemGroupId(int $a_val)
write(string $message, $level=ilLogLevel::INFO, array $context=[])
write log message
static _isFileHidden(string $a_file_name)
Returns true, if a file with the specified name, is usually hidden from the user. ...
static _lookupObjId(int $ref_id)
getChildsByType(int $a_node_id, string $a_type)
get child nodes of given node by object type
addItem(int $a_item_ref_id)
setItemGroupRefId(int $a_val)
static _getItemsOfContainer(int $a_ref_id)
ilObjectDataCache $obj_data_cache
ilObjectDefinition $obj_def
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $a_item_group_ref_id=0)
cloneItems(int $a_source_id, int $a_copy_id)
static _getInstance(int $a_copy_id)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)