ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilItemGroupItems Class Reference

Item group items. More...

+ Collaboration diagram for ilItemGroupItems:

Public Member Functions

 ilItemGroupItems ($a_item_group_ref_id=0)
 Constructor.
 setItemGroupId ($a_val)
 Set item group id.
 getItemGroupId ()
 Get item group id.
 setItemGroupRefId ($a_val)
 Set item group ref id.
 getItemGroupRefId ()
 Get item group ref id.
 setItems ($a_val)
 Set items.
 getItems ()
 Get items.
 addItem ($a_item_ref_id)
 Add one item.
 delete ()
 Delete items of item group.
 update ()
 Update item group items.
 read ()
 Read item group items.
 getAssignableItems ()
 Get assignable items.
 getValidItems ()
 Get valid items.
 cloneItems ($a_source_id, $a_copy_id)
 Clone items.
 _getItemsOfContainer ($a_ref_id)

Data Fields

 $ilDB
 $tree
 $lng
 $item_group_id = 0
 $item_group_ref_id = 0
 $items = array()

Detailed Description

Item group items.

This class is used to store the materials (items) that are assigned to an item group. Main table used is item_group_item

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 15 of file class.ilItemGroupItems.php.

Member Function Documentation

ilItemGroupItems::_getItemsOfContainer (   $a_ref_id)

Definition at line 281 of file class.ilItemGroupItems.php.

References $ilDB, $items, $query, $res, $row, $tree, and DB_FETCHMODE_OBJECT.

Referenced by ilRepositoryExplorer\isVisible().

{
global $ilDB,$tree;
$itgr_nodes = $tree->getChildsByType($a_ref_id,'itgr');
foreach ($itgr_nodes as $node)
{
$itgr_ids[] = $node['obj_id'];
}
$query = "SELECT item_ref_id FROM item_group_item ".
"WHERE ".$ilDB->in('item_group_id', $itgr_ids,false,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$items[] = $row->item_ref_id;
}
return $items ? $items : array();
}

+ Here is the caller graph for this function:

ilItemGroupItems::addItem (   $a_item_ref_id)

Add one item.

Parameters
int$a_item_ref_iditem ref id

Definition at line 116 of file class.ilItemGroupItems.php.

Referenced by ilObjItemGroupGUI\afterSaveCallback().

{
if (!in_array($a_item_ref_id, $this->items))
{
$this->items[] = (int) $a_item_ref_id;
}
}

+ Here is the caller graph for this function:

ilItemGroupItems::cloneItems (   $a_source_id,
  $a_copy_id 
)

Clone items.

public

Parameters
intsource event id
intcopy id

Definition at line 250 of file class.ilItemGroupItems.php.

References $ilLog, ilCopyWizardOptions\_getInstance(), ilItemGroupItems(), setItems(), and update().

{
global $ilObjDataCache,$ilLog;
$ilLog->write(__METHOD__.': Begin cloning item group materials ... -'.$a_source_id.'-');
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$mappings = $cwo->getMappings();
$new_items = array();
// check: is this a ref id!?
$source_ig = new ilItemGroupItems($a_source_id);
foreach($source_ig->getItems() as $item_ref_id)
{
if(isset($mappings[$item_ref_id]) and $mappings[$item_ref_id])
{
$ilLog->write(__METHOD__.': Clone item group item nr. '.$item_ref_id);
$new_items[] = $mappings[$item_ref_id];
}
else
{
$ilLog->write(__METHOD__.': No mapping found for item group item nr. '.$item_ref_id);
}
}
$this->setItems($new_items);
$this->update();
$ilLog->write(__METHOD__.': Finished cloning item group items ...');
return true;
}

+ Here is the call graph for this function:

ilItemGroupItems::delete ( )

Delete items of item group.

Definition at line 127 of file class.ilItemGroupItems.php.

References $query, and getItemGroupId().

{
$query = "DELETE FROM item_group_item ".
"WHERE item_group_id = ".$this->db->quote($this->getItemGroupId(), 'integer');
$this->db->manipulate($query);
}

+ Here is the call graph for this function:

ilItemGroupItems::getAssignableItems ( )

Get assignable items.

Parameters
@return

Definition at line 173 of file class.ilItemGroupItems.php.

References ilObjFileAccess\_isFileHidden(), getItemGroupRefId(), and ilUtil\sortArray().

Referenced by getValidItems().

{
global $objDefinition;
if ($this->getItemGroupRefId() <= 0)
{
return array();
}
$parent_node = $this->tree->getNodeData(
$this->tree->getParentId($this->getItemGroupRefId()));
$materials = array();
$nodes = $this->tree->getChilds($parent_node["child"]);
include_once("./Modules/File/classes/class.ilObjFileAccess.php");
foreach($nodes as $node)
{
// filter side blocks and session, item groups and role folder
if ($node['child'] == $parent_node["child"] ||
$this->obj_def->isSideBlock($node['type']) ||
in_array($node['type'], array('sess', 'itgr', 'rolf', 'adm')))
{
continue;
}
// filter hidden files
// see http://www.ilias.de/mantis/view.php?id=10269
if ($node['type'] == "file" &&
{
continue;
}
if ($objDefinition->isInactivePlugin($node['type']))
{
continue;
}
$materials[] = $node;
}
$materials = ilUtil::sortArray($materials, "title", "asc");
return $materials;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilItemGroupItems::getItemGroupId ( )

Get item group id.

Returns
int item group id

Definition at line 66 of file class.ilItemGroupItems.php.

References $item_group_id.

Referenced by delete(), ilItemGroupItems(), and update().

{
}

+ Here is the caller graph for this function:

ilItemGroupItems::getItemGroupRefId ( )

Get item group ref id.

Returns
int item group ref id

Definition at line 86 of file class.ilItemGroupItems.php.

References $item_group_ref_id.

Referenced by getAssignableItems(), and ilItemGroupItems().

+ Here is the caller graph for this function:

ilItemGroupItems::getItems ( )

Get items.

Returns
array items (array of ref ids)

Definition at line 106 of file class.ilItemGroupItems.php.

References $items.

Referenced by ilItemGroupItemsTableGUI\__construct(), and getValidItems().

{
return $this->items;
}

+ Here is the caller graph for this function:

ilItemGroupItems::getValidItems ( )

Get valid items.

Parameters
@return

Definition at line 227 of file class.ilItemGroupItems.php.

References $items, getAssignableItems(), and getItems().

{
$items = $this->getItems();
$ass_items = $this->getAssignableItems();
$valid_items = array();
foreach ($ass_items as $aitem)
{
if (in_array($aitem["ref_id"], $items))
{
$valid_items[] = $aitem["ref_id"];
}
}
return $valid_items;
}

+ Here is the call graph for this function:

ilItemGroupItems::ilItemGroupItems (   $a_item_group_ref_id = 0)

Constructor.

Parameters
int$a_item_group_ref_idref id of item group

Definition at line 30 of file class.ilItemGroupItems.php.

References $ilDB, $lng, $tree, ilObject\_lookupObjId(), getItemGroupId(), getItemGroupRefId(), read(), setItemGroupId(), and setItemGroupRefId().

Referenced by cloneItems().

{
global $ilDB, $lng, $tree, $objDefinition;
$this->db = $ilDB;
$this->lng = $lng;
$this->tree = $tree;
$this->obj_def = $objDefinition;
$this->setItemGroupRefId((int) $a_item_group_ref_id);
if ($this->getItemGroupRefId() > 0)
{
$this->setItemGroupId((int) ilObject::_lookupObjId($a_item_group_ref_id));
}
if ($this->getItemGroupId() > 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilItemGroupItems::read ( )

Read item group items.

Definition at line 155 of file class.ilItemGroupItems.php.

Referenced by ilItemGroupItems().

{
$this->items = array();
$set = $this->db->query("SELECT * FROM item_group_item ".
" WHERE item_group_id = ".$this->db->quote($this->getItemGroupId(), "integer")
);
while ($rec = $this->db->fetchAssoc($set))
{
$this->items[] = $rec["item_ref_id"];
}
}

+ Here is the caller graph for this function:

ilItemGroupItems::setItemGroupId (   $a_val)

Set item group id.

Parameters
int$a_valitem group id

Definition at line 56 of file class.ilItemGroupItems.php.

Referenced by ilItemGroupItems().

{
$this->item_group_id = $a_val;
}

+ Here is the caller graph for this function:

ilItemGroupItems::setItemGroupRefId (   $a_val)

Set item group ref id.

Parameters
int$a_valitem group ref id

Definition at line 76 of file class.ilItemGroupItems.php.

Referenced by ilItemGroupItems().

{
$this->item_group_ref_id = $a_val;
}

+ Here is the caller graph for this function:

ilItemGroupItems::setItems (   $a_val)

Set items.

Parameters
array$a_valitems (array of ref ids)

Definition at line 96 of file class.ilItemGroupItems.php.

Referenced by cloneItems().

{
$this->items = $a_val;
}

+ Here is the caller graph for this function:

ilItemGroupItems::update ( )

Update item group items.

Definition at line 137 of file class.ilItemGroupItems.php.

References $query, and getItemGroupId().

Referenced by cloneItems().

{
$this->delete();
foreach($this->items as $item)
{
$query = "INSERT INTO item_group_item (item_group_id,item_ref_id) ".
"VALUES( ".
$this->db->quote($this->getItemGroupId() ,'integer').", ".
$this->db->quote($item ,'integer')." ".
")";
$this->db->manipulate($query);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilItemGroupItems::$ilDB

Definition at line 17 of file class.ilItemGroupItems.php.

Referenced by _getItemsOfContainer(), and ilItemGroupItems().

ilItemGroupItems::$item_group_id = 0

Definition at line 21 of file class.ilItemGroupItems.php.

Referenced by getItemGroupId().

ilItemGroupItems::$item_group_ref_id = 0

Definition at line 22 of file class.ilItemGroupItems.php.

Referenced by getItemGroupRefId().

ilItemGroupItems::$items = array()

Definition at line 23 of file class.ilItemGroupItems.php.

Referenced by _getItemsOfContainer(), getItems(), and getValidItems().

ilItemGroupItems::$lng

Definition at line 19 of file class.ilItemGroupItems.php.

Referenced by ilItemGroupItems().

ilItemGroupItems::$tree

Definition at line 18 of file class.ilItemGroupItems.php.

Referenced by _getItemsOfContainer(), and ilItemGroupItems().


The documentation for this class was generated from the following file: