ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLPCollections Class Reference

Class ilLPObjSettings. More...

+ Collaboration diagram for ilLPCollections:

Public Member Functions

 ilLPCollections ($a_obj_id)
 cloneCollections ($a_target_id, $a_copy_id)
 Clone collections.
 getObjId ()
 getItems ()
 isAssigned ($a_ref_id)
 add ($item_id)
 delete ($item_id)
 _getCountPossibleSAHSItems ($a_target_id)
 _getPossibleSAHSItems ($target_id)
 get all tracking items of scorm or aicc object
 deleteAll ()
_getItems ($a_obj_id, $a_use_subtree_by_id=false)
 __deleteEntry ($a_obj_id, $a_item_id)
 __read ()
 _getScoresForUserAndCP_Node_Id ($target_id, $item_id, $user_id)

Static Public Member Functions

static deactivate ($a_obj_id, array $a_item_ids)
 Deactivate assignments.
static activate ($a_obj_id, array $a_item_ids)
 Activate assignment.
static createNewGrouping ($a_obj_id, array $a_ids)
 Create new grouping ilDB.
static saveObligatoryMaterials ($a_obj_id, array $a_obl)
static releaseGrouping ($a_obj_id, array $a_ids)
 Release grouping of materials.
static hasGroupedItems ($a_obj_id)
 Check if there is any grouped material assigned.
static lookupGroupedItems ($a_obj_id, $item_id)
 Lookup grouped items ilDB $ilDB.
static _getPossibleItems ($a_target_id, $a_collection=null)
static _getCountPossibleItems ($a_target_id)
static _deleteAll ($a_obj_id)
static getGroupedItems ($a_obj_id, $a_use_subtree_by_id=false)
 Get groped items.

Data Fields

 $db = null
 $obj_id = null
 $items = array()

Detailed Description

Class ilLPObjSettings.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Member Function Documentation

ilLPCollections::__deleteEntry (   $a_obj_id,
  $a_item_id 
)

Definition at line 633 of file class.ilLPCollections.php.

References $query, and $res.

Referenced by __read(), and _getItems().

{
global $ilDB;
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"AND item_id = ".$ilDB->quote($a_item_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

ilLPCollections::__read ( )

Definition at line 645 of file class.ilLPCollections.php.

References $query, $res, $row, __deleteEntry(), ilObject\_getAllReferences(), _getPossibleItems(), ilObjTest\_lookupAnonymity(), DB_FETCHMODE_OBJECT, and getObjId().

Referenced by add(), delete(), and ilLPCollections().

{
global $ilObjDataCache, $ilDB;
$this->items = array();
if($ilObjDataCache->lookupType($this->getObjId()) != 'sahs')
{
$course_ref_ids = ilObject::_getAllReferences($this->getObjId());
$course_ref_id = end($course_ref_ids);
$query = "SELECT * FROM ut_lp_collections utc ".
"JOIN object_reference obr ON item_id = ref_id ".
"JOIN object_data obd ON obr.obj_id = obd.obj_id ".
"WHERE utc.obj_id = ".$this->db->quote($this->obj_id,'integer')." ".
"AND active = ".$ilDB->quote(1,'integer')." ".
"ORDER BY title";
}
else
{
$query = "SELECT * FROM ut_lp_collections WHERE obj_id = ".$ilDB->quote($this->getObjId() ,'integer')." ".
"AND active = ".$ilDB->quote(1,'integer');
}
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($ilObjDataCache->lookupType($this->getObjId()) != 'sahs')
{
if(!in_array($row->item_id,ilLPCollections::_getPossibleItems($course_ref_id)))
{
$this->__deleteEntry($this->getObjId(),$row->item_id);
continue;
}
}
// Check anonymized
if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) == 'tst')
{
include_once './Modules/Test/classes/class.ilObjTest.php';
if(ilObjTest::_lookupAnonymity($item_obj_id))
{
$this->__deleteEntry($this->getObjId(),$row->item_id);
continue;
}
}
$this->items[] = $row->item_id;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPCollections::_deleteAll (   $a_obj_id)
static

Definition at line 522 of file class.ilLPCollections.php.

References $query, and $res.

Referenced by deleteAll(), ilTrackingAppEventListener\handleDelete(), and ilTrackingTest\testLPCollections().

{
global $ilDB;
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')."";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilLPCollections::_getCountPossibleItems (   $a_target_id)
static

Definition at line 462 of file class.ilLPCollections.php.

References _getPossibleItems().

{
return count(ilLPCollections::_getPossibleItems($a_target_id));
}

+ Here is the call graph for this function:

ilLPCollections::_getCountPossibleSAHSItems (   $a_target_id)

Definition at line 467 of file class.ilLPCollections.php.

References _getPossibleSAHSItems().

Referenced by ilLPObjSettings\getValidModes().

{
return count(ilLPCollections::_getPossibleSAHSItems($a_target_id));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilLPCollections::_getItems (   $a_obj_id,
  $a_use_subtree_by_id = false 
)

Definition at line 561 of file class.ilLPCollections.php.

References $items, $query, $res, $row, __deleteEntry(), ilObject\_getAllReferences(), ilCourseObjective\_getObjectiveIds(), _getPossibleItems(), ilObjTest\_lookupAnonymity(), ilLPObjSettings\_lookupMode(), DB_FETCHMODE_OBJECT, LP_MODE_COLLECTION, LP_MODE_MANUAL_BY_TUTOR, LP_MODE_OBJECTIVES, and LP_MODE_SCORM.

Referenced by getGroupedItems().

{
global $ilObjDataCache;
global $ilDB, $tree;
include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
$mode = ilLPObjSettings::_lookupMode($a_obj_id);
if($mode == LP_MODE_OBJECTIVES)
{
include_once 'Modules/Course/classes/class.ilCourseObjective.php';
}
if($mode != LP_MODE_SCORM and $mode != LP_MODE_COLLECTION and $mode != LP_MODE_MANUAL_BY_TUTOR)
{
return array();
}
if($ilObjDataCache->lookupType($a_obj_id) != 'sahs')
{
$course_ref_ids = ilObject::_getAllReferences($a_obj_id);
$course_ref_id = end($course_ref_ids);
if (!$a_use_subtree_by_id)
{
$possible_items = ilLPCollections::_getPossibleItems($course_ref_id);
}
else
{
$possible_items = $tree->getSubTreeIds($course_ref_id);
}
$query = "SELECT * FROM ut_lp_collections utc ".
"JOIN object_reference obr ON item_id = ref_id ".
"JOIN object_data obd ON obr.obj_id = obd.obj_id ".
"WHERE utc.obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND active = ".$ilDB->quote(1,'integer')." ".
"ORDER BY title";
}
else
{
// SAHS
$query = "SELECT * FROM ut_lp_collections WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"AND active = ".$ilDB->quote(1,'integer');
}
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($ilObjDataCache->lookupType($a_obj_id) != 'sahs')
{
if(!in_array($row->item_id,$possible_items))
{
ilLPCollections::__deleteEntry($a_obj_id,$row->item_id);
continue;
}
}
// Check anonymized
if($ilObjDataCache->lookupType($item_obj_id = $ilObjDataCache->lookupObjId($row->item_id)) == 'tst')
{
include_once './Modules/Test/classes/class.ilObjTest.php';
if(ilObjTest::_lookupAnonymity($item_obj_id))
{
ilLPCollections::__deleteEntry($a_obj_id,$row->item_id);
continue;
}
}
$items[] = $row->item_id;
}
return $items ? $items : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPCollections::_getPossibleItems (   $a_target_id,
  $a_collection = null 
)
static

Definition at line 410 of file class.ilLPCollections.php.

References ilRepositoryObjectPluginSlot\isTypePluginWithLP().

Referenced by __read(), _getCountPossibleItems(), _getItems(), and ilLPCollectionSettingsTableGUI\parseCollection().

{
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();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::_getPossibleSAHSItems (   $target_id)

get all tracking items of scorm or aicc object

Definition at line 477 of file class.ilLPCollections.php.

References $items, $target_id, ilObjSCORMLearningModule\_getTrackingItems(), ilObjAICCLearningModule\_getTrackingItems(), ilObjSCORM2004LearningModule\_getTrackingItems(), and ilObjSAHSLearningModule\_lookupSubType().

Referenced by _getCountPossibleSAHSItems(), ilSCORMCertificateAdapter\getCertificateVariablesDescription(), ilSCORMCertificateAdapter\getCertificateVariablesForPresentation(), ilSCORMCertificateAdapter\getCertificateVariablesForPreview(), ilConditionHandlerInterface\initFormCondition(), and ilLPCollectionSettingsTableGUI\parseScormCollection().

{
include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
{
case 'hacp':
case 'aicc':
include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
{
$items["$item[obj_id]"]['title'] = $item['title'];
#$items[$item->getId()]['title'] = $item->getTitle();
}
return $items ? $items : array();
case 'scorm':
include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
{
$items[$item->getId()]['title'] = $item->getTitle();
}
return $items ? $items : array();
case 'scorm2004':
include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
{
$items[$item["id"]]['title'] = $item["title"];
}
return $items ? $items : array();
}
return array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::_getScoresForUserAndCP_Node_Id (   $target_id,
  $item_id,
  $user_id 
)

Definition at line 693 of file class.ilLPCollections.php.

References $target_id, ilObjSCORM2004LearningModule\_getScores2004ForUser(), ilObjSCORMLearningModule\_getScoresForUser(), and ilObjSAHSLearningModule\_lookupSubType().

Referenced by ilSCORMCertificateAdapter\getCertificateVariablesForPresentation().

{
include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
{
case 'hacp':
case 'aicc':
include_once './Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php';
return ilObjAICCLearningModule::_getScoresForUser($item_id, $user_id);
case 'scorm':
include_once './Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
//include_once './Modules/ScormAicc/classes/SCORM/class.ilSCORMItem.php';
return ilObjSCORMLearningModule::_getScoresForUser($item_id, $user_id);
case 'scorm2004':
include_once './Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php';
}
return array("raw" => null, "max" => null, "scaled" => null);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPCollections::activate (   $a_obj_id,
array  $a_item_ids 
)
static

Activate assignment.

Parameters
int$a_obj_id
array$a_item_ids

Definition at line 142 of file class.ilLPCollections.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilLPListOfSettingsGUI\assign(), and createNewGrouping().

{
global $ilDB;
// Add missing entries
$sql = "SELECT item_id,active FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id', $a_item_ids, false, 'integer');
$res = $ilDB->query($sql);
$items_existing = $remove_existing = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->active)
{
$items_existing[] = $row->item_id;
}
else
{
$remove_existing[] = $row->item_id;
}
}
// #13278 - because of grouping inactive items may exist
if(sizeof($remove_existing))
{
$ilDB->manipulate("DELETE FROM ut_lp_collections".
" WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer').
" AND ".$ilDB->in("item_id", $remove_existing, "", "integer"));
}
$items_not_existing = array_diff($a_item_ids, $items_existing);
foreach($items_not_existing as $item)
{
$query = "INSERT INTO ut_lp_collections (obj_id,item_id,grouping_id,num_obligatory,active ) ".
"VALUES( ".
$ilDB->quote($a_obj_id,'integer').", ".
$ilDB->quote($item,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote(0,'integer').", ".
$ilDB->quote(1,'integer')." ".
")";
$ilDB->manipulate($query);
}
// Select all grouping ids and activate them
$query = "SELECT grouping_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id', $a_item_ids, false, 'integer')." ".
"AND grouping_id > ".$ilDB->quote(0,'integer')." ";
$res = $ilDB->query($query);
$grouping_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$grouping_ids[] = $row->grouping_id;
}
$query = "UPDATE ut_lp_collections ".
"SET active = ".$ilDB->quote(1,'integer')." ".
"WHERE ".$ilDB->in('grouping_id', $grouping_ids, false, 'integer')." ".
"AND obj_id = ".$ilDB->quote($a_obj_id,'integer');
$ilDB->manipulate($query);
return;
}

+ Here is the caller graph for this function:

ilLPCollections::add (   $item_id)

Definition at line 78 of file class.ilLPCollections.php.

References $query, $res, __read(), and getObjId().

{
global $ilDB;
$query = "SELECT * FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($this->getObjId(),'integer')." ".
"AND item_id = ".$ilDB->quote($item_id,'integer');
$res = $ilDB->query($query);
if($res->numRows())
{
return true;
}
$query = "INSERT INTO ut_lp_collections (obj_id, item_id) ".
"VALUES( ".
$ilDB->quote($this->obj_id ,'integer').", ".
$ilDB->quote($item_id ,'integer').
")";
$res = $ilDB->manipulate($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilLPCollections::cloneCollections (   $a_target_id,
  $a_copy_id 
)

Clone collections.

public

Parameters

Definition at line 40 of file class.ilLPCollections.php.

References $ilLog, ilCopyWizardOptions\_getInstance(), and ilLPCollections().

{
global $ilObjDataCache,$ilLog;
$target_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$mappings = $cwo->getMappings();
$new_collections = new ilLPCollections($target_obj_id);
foreach($this->items as $item)
{
if(!isset($mappings[$item]) or !$mappings[$item])
{
continue;
}
// @FIXME clone this and not add it
$new_collections->add($mappings[$item]);
$ilLog->write(__METHOD__.': Added learning progress collection.');
}
}

+ Here is the call graph for this function:

static ilLPCollections::createNewGrouping (   $a_obj_id,
array  $a_ids 
)
static

Create new grouping ilDB.

Definition at line 211 of file class.ilLPCollections.php.

References $query, $res, $row, activate(), DB_FETCHMODE_OBJECT, and releaseGrouping().

Referenced by ilLPListOfSettingsGUI\groupMaterials().

{
global $ilDB;
// Activate each of this items
self::activate($a_obj_id, $a_ids);
// read all grouping ids and their item_ids
$query = "SELECT DISTINCT(grouping_id) grp_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id', $a_ids, false, 'integer')." ".
"AND grouping_id != 0 ";
$res = $ilDB->query($query);
$grp_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$grp_ids[] = $row->grp_id;
}
$query = "SELECT item_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('grouping_id', $grp_ids, false, 'integer');
$res = $ilDB->query($query);
$all_item_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$all_item_ids[] = $row->item_id;
}
$all_item_ids = array_unique(array_merge($all_item_ids,$a_ids));
// release grouping
self::releaseGrouping($a_obj_id,$a_ids);
// Create new grouping
$query = "SELECT MAX(grouping_id) grp FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"GROUP BY obj_id ";
$res = $ilDB->query($query);
$grp_id = 0;
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$grp_id = $row->grp;
}
++$grp_id;
$query = "UPDATE ut_lp_collections SET ".
"grouping_id = ".$ilDB->quote($grp_id,'integer').", ".
"num_obligatory = 1, ".
"active = ".$ilDB->quote(1,'integer')." ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id',$all_item_ids,false,'integer');
$ilDB->manipulate($query);
return;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPCollections::deactivate (   $a_obj_id,
array  $a_item_ids 
)
static

Deactivate assignments.

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilLPListOfSettingsGUI\deassign().

{
global $ilDB;
// Delete all non grouped items
$query = "DELETE FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id', $a_item_ids, false, 'integer')." ".
"AND grouping_id = ".$ilDB->quote(0, 'integer');
$ilDB->manipulate($query);
// Select all grouping ids and deactivate them
$query = "SELECT grouping_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND ".$ilDB->in('item_id', $a_item_ids, false, 'integer');
$res = $ilDB->query($query);
$grouping_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$grouping_ids[] = $row->grouping_id;
}
$query = "UPDATE ut_lp_collections ".
"SET active = ".$ilDB->quote(0,'integer')." ".
"WHERE ".$ilDB->in('grouping_id', $grouping_ids, false, 'integer')." ".
"AND obj_id = ".$ilDB->quote($a_obj_id,'integer');
$ilDB->manipulate($query);
return;
}

+ Here is the caller graph for this function:

ilLPCollections::delete (   $item_id)

Definition at line 394 of file class.ilLPCollections.php.

References $query, $res, and __read().

{
global $ilDB;
$query = "DELETE FROM ut_lp_collections ".
"WHERE item_id = ".$ilDB->quote($item_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($this->obj_id ,'integer')." ";
$res = $ilDB->manipulate($query);
$this->__read();
return true;
}

+ Here is the call graph for this function:

ilLPCollections::deleteAll ( )

Definition at line 516 of file class.ilLPCollections.php.

References _deleteAll(), and getObjId().

Referenced by ilConditionHandlerInterface\assign().

{
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilLPCollections::getGroupedItems (   $a_obj_id,
  $a_use_subtree_by_id = false 
)
static

Get groped items.

Parameters
int$a_obj_id
Returns
array

Definition at line 538 of file class.ilLPCollections.php.

References $items, $query, $res, $row, _getItems(), and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$items = self::_getItems($a_obj_id, $a_use_subtree_by_id);
$query = "SELECT * FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND active = 1";
$res = $ilDB->query($query);
$grouped = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if(in_array($row->item_id,$items))
{
$grouped[$row->grouping_id]['items'][] = $row->item_id;
$grouped[$row->grouping_id]['num_obligatory'] = $row->num_obligatory;
}
}
return $grouped;
}

+ Here is the call graph for this function:

ilLPCollections::getItems ( )

Definition at line 68 of file class.ilLPCollections.php.

References $items.

{
return $this->items;
}
ilLPCollections::getObjId ( )

Definition at line 63 of file class.ilLPCollections.php.

References $obj_id.

Referenced by __read(), add(), and deleteAll().

{
return (int) $this->obj_id;
}

+ Here is the caller graph for this function:

static ilLPCollections::hasGroupedItems (   $a_obj_id)
static

Check if there is any grouped material assigned.

ilDB $ilDB

Parameters
int$a_obj_id
Returns
bool

Definition at line 345 of file class.ilLPCollections.php.

References $query, and $res.

Referenced by ilLPCollectionSettingsTableGUI\initTable().

{
global $ilDB;
$query = "SELECT item_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND grouping_id > 0 ";
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the caller graph for this function:

ilLPCollections::ilLPCollections (   $a_obj_id)

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

References __read().

Referenced by cloneCollections().

{
global $ilObjDataCache,$ilDB;
$this->db =& $ilDB;
$this->obj_id = $a_obj_id;
$this->__read();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPCollections::isAssigned (   $a_ref_id)

Definition at line 73 of file class.ilLPCollections.php.

{
return (bool) in_array($a_ref_id,$this->items);
}
static ilLPCollections::lookupGroupedItems (   $a_obj_id,
  $item_id 
)
static

Lookup grouped items ilDB $ilDB.

Parameters
int$a_obj_id
int$item_id
Returns
array item ids grouped by grouping id

Definition at line 363 of file class.ilLPCollections.php.

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

Referenced by ilLPCollectionSettingsTableGUI\parseCollection().

{
global $ilDB;
$query = "SELECT grouping_id FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND item_id = ".$ilDB->quote($item_id,'integer');
$res = $ilDB->query($query);
$grouping_id = $row->grouping_id;
if($grouping_id == 0)
{
return array();
}
$query = "SELECT item_id, num_obligatory FROM ut_lp_collections ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND grouping_id = ".$ilDB->quote($grouping_id,'integer');
$res = $ilDB->query($query);
$items = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$items['items'][] = $row->item_id;
$items['num_obligatory'] = $row->num_obligatory;
$items['grouping_id'] = $grouping_id;
}
return $items;
}

+ Here is the caller graph for this function:

static ilLPCollections::releaseGrouping (   $a_obj_id,
array  $a_ids 
)
static

Release grouping of materials.

Parameters
intobj_id
array$a_ids

Definition at line 311 of file class.ilLPCollections.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by createNewGrouping(), and ilLPListOfSettingsGUI\releaseMaterials().

{
global $ilDB;
$query = "SELECT grouping_id FROM ut_lp_collections ".
"WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
"AND ".$ilDB->in('item_id', $a_ids, false, 'integer')." ".
"AND grouping_id > 0 ";
$res = $ilDB->query($query);
$grp_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$grp_ids[] = $row->grouping_id;
}
$query = "UPDATE ut_lp_collections ".
"SET grouping_id = ".$ilDB->quote(0,'integer').", ".
"num_obligatory = 0 ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
"AND " . $ilDB->in('grouping_id', $grp_ids, false, 'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

static ilLPCollections::saveObligatoryMaterials (   $a_obj_id,
array  $a_obl 
)
static
Parameters
<type>$a_obj_id
array$a_oblthrows UnexpectedValueException

Definition at line 277 of file class.ilLPCollections.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
foreach($a_obl as $grouping_id => $num)
{
$query = "SELECT count(obj_id) num FROM ut_lp_collections ".
'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer').' '.
'AND grouping_id = '.$ilDB->quote($grouping_id,'integer').' '.
'GROUP BY obj_id';
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($num <= 0 or $num >= $row->num)
{
throw new UnexpectedValueException();
}
}
}
foreach($a_obl as $grouping_id => $num)
{
$query = 'UPDATE ut_lp_collections '.
'SET num_obligatory = '.$ilDB->quote($num, 'integer').' '.
'WHERE obj_id = '.$ilDB->quote($a_obj_id,'integer').' '.
'AND grouping_id = '.$ilDB->quote($grouping_id,'integer');
$ilDB->manipulate($query);
}
}

Field Documentation

ilLPCollections::$db = null

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

ilLPCollections::$items = array()
ilLPCollections::$obj_id = null

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

Referenced by getObjId().


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