ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilContainerStartObjects Class Reference

ilContainerStartObjects More...

+ Collaboration diagram for ilContainerStartObjects:

Public Member Functions

 __construct ($a_object_ref_id, $a_object_id)
 getObjId ()
 getRefId ()
 getStartObjects ()
 delete ($a_crs_start_id)
 Delete item by sequence id type $ilDB.
 deleteItem ($a_item_ref_id)
 Delete item by ref_id.
 exists ($a_item_ref_id)
 add ($a_item_ref_id)
 __deleteAll ()
 setObjectPos ($a_start_id, $a_pos)
 getPossibleStarters ()
 allFullfilled ($a_user_id)
 isFullfilled ($a_user_id, $a_item_id)
 cloneDependencies ($a_target_id, $a_copy_id)

Static Public Member Functions

static isStartObject ($a_container_id, $a_item_ref_id)
 Check if object is start object type $ilDB.

Protected Member Functions

 setObjId ($a_id)
 setRefId ($a_ref_id)
 __read ()

Protected Attributes

 $ref_id
 $obj_id
 $start_objs = array()

Detailed Description

ilContainerStartObjects

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:
class.ilCourseStart.php 44362 2013-08-22 08:36:03Z jluetzen

Definition at line 12 of file class.ilContainerStartObjects.php.

Constructor & Destructor Documentation

ilContainerStartObjects::__construct (   $a_object_ref_id,
  $a_object_id 
)

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

References __read(), setObjId(), and setRefId().

{
$this->setRefId($a_object_ref_id);
$this->setObjId($a_object_id);
$this->__read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilContainerStartObjects::__deleteAll ( )

Definition at line 145 of file class.ilContainerStartObjects.php.

References $ilDB, $query, and getObjId().

{
global $ilDB;
$query = "DELETE FROM crs_start".
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), 'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilContainerStartObjects::__read ( )
protected

Definition at line 51 of file class.ilContainerStartObjects.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getObjId().

Referenced by __construct().

{
global $tree, $ilDB;
$this->start_objs = array();
$query = "SELECT * FROM crs_start".
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), 'integer').
" ORDER BY pos, crs_start_id";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($tree->isInTree($row->item_ref_id))
{
$this->start_objs[$row->crs_start_id]['item_ref_id'] = $row->item_ref_id;
}
else
{
$this->delete($row->item_ref_id);
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerStartObjects::add (   $a_item_ref_id)

Definition at line 119 of file class.ilContainerStartObjects.php.

References $ilDB, $query, and getObjId().

Referenced by ilLOSettings\updateStartObjects().

{
global $ilDB;
if($a_item_ref_id)
{
$max_pos = $ilDB->query("SELECT max(pos) pos FROM crs_start".
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), "integer"));
$max_pos = $ilDB->fetchAssoc($max_pos);
$max_pos = ((int)$max_pos["pos"])+10;
$next_id = $ilDB->nextId('crs_start');
$query = "INSERT INTO crs_start".
" (crs_start_id,crs_id,item_ref_id,pos)".
" VALUES".
" (".$ilDB->quote($next_id, 'integer').
", ".$ilDB->quote($this->getObjId(), 'integer').
", ".$ilDB->quote($a_item_ref_id, 'integer').
", ".$ilDB->quote($max_pos, 'integer').
")";
$ilDB->manipulate($query);
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerStartObjects::allFullfilled (   $a_user_id)

Definition at line 188 of file class.ilContainerStartObjects.php.

References getStartObjects(), and isFullfilled().

{
foreach($this->getStartObjects() as $item)
{
if(!$this->isFullfilled($a_user_id, $item['item_ref_id']))
{
return false;
}
}
return true;
}

+ Here is the call graph for this function:

ilContainerStartObjects::cloneDependencies (   $a_target_id,
  $a_copy_id 
)

Definition at line 248 of file class.ilContainerStartObjects.php.

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

{
global $ilObjDataCache, $ilLog;
$ilLog->write(__METHOD__.': Begin course start objects...');
$new_obj_id = $ilObjDataCache->lookupObjId($a_target_id);
$start = new self($a_target_id, $new_obj_id);
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
$mappings = $cwo->getMappings();
foreach($this->getStartObjects() as $data)
{
$item_ref_id = $data['item_ref_id'];
if(isset($mappings[$item_ref_id]) and $mappings[$item_ref_id])
{
$ilLog->write(__METHOD__.': Clone start object nr. '.$item_ref_id);
$start->add($mappings[$item_ref_id]);
}
else
{
$ilLog->write(__METHOD__.': No mapping found for start object nr. '.$item_ref_id);
}
}
$ilLog->write(__METHOD__.': ... end course start objects');
return true;
}

+ Here is the call graph for this function:

ilContainerStartObjects::delete (   $a_crs_start_id)

Delete item by sequence id type $ilDB.

Parameters
type$a_crs_start_id
Returns
boolean

Definition at line 81 of file class.ilContainerStartObjects.php.

References $ilDB, $query, and getObjId().

{
global $ilDB;
$query = "DELETE FROM crs_start".
" WHERE crs_start_id = ".$ilDB->quote($a_crs_start_id, 'integer').
" AND crs_id = ".$ilDB->quote($this->getObjId(), 'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilContainerStartObjects::deleteItem (   $a_item_ref_id)

Delete item by ref_id.

Parameters
type$a_item_ref_id

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

References $ilDB, $query, and getObjId().

Referenced by ilLOSettings\updateStartObjects().

{
global $ilDB;
$query = "DELETE FROM crs_start".
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), 'integer').
" AND item_ref_id = ".$ilDB->quote($a_item_ref_id, 'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerStartObjects::exists (   $a_item_ref_id)

Definition at line 107 of file class.ilContainerStartObjects.php.

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

Referenced by ilLOSettings\updateStartObjects().

{
global $ilDB;
$query = "SELECT * FROM crs_start".
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), 'integer').
" AND item_ref_id = ".$ilDB->quote($a_item_ref_id, 'integer');
$res = $ilDB->query($query);
return $res->numRows() ? true : false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerStartObjects::getObjId ( )

Definition at line 31 of file class.ilContainerStartObjects.php.

References $obj_id.

Referenced by __deleteAll(), __read(), add(), delete(), deleteItem(), exists(), and setObjectPos().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

ilContainerStartObjects::getPossibleStarters ( )

Definition at line 170 of file class.ilContainerStartObjects.php.

References ilObjectActivation\getItems(), and getRefId().

{
include_once "Services/Object/classes/class.ilObjectActivation.php";
foreach(ilObjectActivation::getItems($this->getRefId(), false) as $node)
{
switch($node['type'])
{
case 'lm':
case 'sahs':
case 'svy':
case 'tst':
$poss_items[] = $node['ref_id'];
break;
}
}
return $poss_items ? $poss_items : array();
}

+ Here is the call graph for this function:

ilContainerStartObjects::getRefId ( )

Definition at line 41 of file class.ilContainerStartObjects.php.

References $ref_id.

Referenced by getPossibleStarters(), and isFullfilled().

{
return $this->ref_id;
}

+ Here is the caller graph for this function:

ilContainerStartObjects::getStartObjects ( )

Definition at line 46 of file class.ilContainerStartObjects.php.

Referenced by allFullfilled(), and cloneDependencies().

{
return $this->start_objs ? $this->start_objs : array();
}

+ Here is the caller graph for this function:

ilContainerStartObjects::isFullfilled (   $a_user_id,
  $a_item_id 
)

Definition at line 200 of file class.ilContainerStartObjects.php.

References $obj_id, ilLPStatus\_hasUserCompleted(), ilObjSurveyAccess\_lookupFinished(), ilObjTestAccess\checkCondition(), and getRefId().

Referenced by allFullfilled().

{
global $ilObjDataCache;
$obj_id = $ilObjDataCache->lookupObjId($a_item_id);
$type = $ilObjDataCache->lookupType($obj_id);
switch($type)
{
case 'tst':
include_once './Modules/Test/classes/class.ilObjTestAccess.php';
if(!ilObjTestAccess::checkCondition($obj_id,'finished','',$a_user_id)) // #14000
{
return false;
}
break;
case 'svy':
include_once './Modules/Survey/classes/class.ilObjSurveyAccess.php';
{
return false;
}
break;
case 'sahs':
include_once 'Services/Tracking/classes/class.ilLPStatus.php';
{
return false;
}
break;
default:
include_once './Modules/Course/classes/class.ilCourseLMHistory.php';
$lm_continue = new ilCourseLMHistory($this->getRefId(), $a_user_id);
$continue_data = $lm_continue->getLMHistory();
if(!isset($continue_data[$a_item_id]))
{
return false;
}
break;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilContainerStartObjects::isStartObject (   $a_container_id,
  $a_item_ref_id 
)
static

Check if object is start object type $ilDB.

Parameters
type$a_container_id
type$a_item_ref_id
Returns
boolean

Definition at line 284 of file class.ilContainerStartObjects.php.

References $ilDB, $query, and $res.

Referenced by ilLOTestQuestionAdapter\isQualifiedStartRun().

{
global $ilDB;
$query = 'SELECT crs_start_id FROM crs_start '.
'WHERE crs_id = '.$ilDB->quote($a_container_id,'integer').' '.
'AND item_ref_id = '.$ilDB->quote($a_item_ref_id,'integer');
$res = $ilDB->query($query);
if($res->numRows() >= 1)
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

ilContainerStartObjects::setObjectPos (   $a_start_id,
  $a_pos 
)

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

References $ilDB, and getObjId().

{
global $ilDB;
if(!(int)$a_start_id || !(int)$a_pos)
{
return;
}
$ilDB->manipulate("UPDATE crs_start".
" SET pos = ".$ilDB->quote($a_pos, "integer").
" WHERE crs_id = ".$ilDB->quote($this->getObjId(), 'integer').
" AND crs_start_id = ".$ilDB->quote($a_start_id, 'integer'));
}

+ Here is the call graph for this function:

ilContainerStartObjects::setObjId (   $a_id)
protected

Definition at line 26 of file class.ilContainerStartObjects.php.

Referenced by __construct().

{
$this->obj_id = $a_id;
}

+ Here is the caller graph for this function:

ilContainerStartObjects::setRefId (   $a_ref_id)
protected

Definition at line 36 of file class.ilContainerStartObjects.php.

Referenced by __construct().

{
$this->ref_id = $a_ref_id;
}

+ Here is the caller graph for this function:

Field Documentation

ilContainerStartObjects::$obj_id
protected

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

Referenced by getObjId(), and isFullfilled().

ilContainerStartObjects::$ref_id
protected

Definition at line 14 of file class.ilContainerStartObjects.php.

Referenced by getRefId().

ilContainerStartObjects::$start_objs = array()
protected

Definition at line 16 of file class.ilContainerStartObjects.php.


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