ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSCTasks Class Reference

Description of class. More...

+ Collaboration diagram for ilSCTasks:

Public Member Functions

 updateFromComponentDefinition ($a_identifier)
 Update from module/service reader. More...
 
 getGroupId ()
 
 getTasks ()
 Get groups. More...
 

Static Public Member Functions

static getInstanceByGroupId ($a_group_id)
 Get singleton instance. More...
 
static lookupGroupId ($a_task_id)
 Lookup group id by task id @global type $ilDB. More...
 
static lookupCompleted ($a_grp_id)
 @global type $ilDB More...
 
static lookupFailed ($a_grp_id)
 @global type $ilDB More...
 
static lookupLastUpdate ($a_grp_id)
 Lookup last update of group tasks @global type $ilDB. More...
 

Protected Member Functions

 read ()
 read groups More...
 

Private Member Functions

 __construct ($a_grp_id)
 Singleton constructor. More...
 

Private Attributes

 $grp_id = 0
 
 $tasks = array()
 

Static Private Attributes

static $instances = array()
 

Detailed Description

Description of class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

ilSCTasks::__construct (   $a_grp_id)
private

Singleton constructor.

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

27 {
28 $this->grp_id = $a_grp_id;
29 $this->read();
30 }
read()
read groups

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getGroupId()

ilSCTasks::getGroupId ( )

Definition at line 143 of file class.ilSCTasks.php.

144 {
145 return $this->grp_id;
146 }

References $grp_id.

Referenced by updateFromComponentDefinition().

+ Here is the caller graph for this function:

◆ getInstanceByGroupId()

static ilSCTasks::getInstanceByGroupId (   $a_group_id)
static

Get singleton instance.

Returns
ilSCTasks

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

37 {
38 if (!array_key_exists($a_group_id, self::$instances)) {
39 return self::$instances[$a_group_id] = new self($a_group_id);
40 }
41 return self::$instances[$a_group_id];
42 }

Referenced by ilObjDefReader\handlerBeginTag(), and ilSCTaskTableGUI\parse().

+ Here is the caller graph for this function:

◆ getTasks()

ilSCTasks::getTasks ( )

Get groups.

Returns
ilSCTask[]

Definition at line 152 of file class.ilSCTasks.php.

153 {
154 return (array) $this->tasks;
155 }

References $tasks.

Referenced by updateFromComponentDefinition().

+ Here is the caller graph for this function:

◆ lookupCompleted()

static ilSCTasks::lookupCompleted (   $a_grp_id)
static

@global type $ilDB

Definition at line 90 of file class.ilSCTasks.php.

91 {
92 global $ilDB;
93
94 $query = 'SELECT count(id) num FROM sysc_tasks ' .
95 'WHERE status = ' . $ilDB->quote(ilSCTask::STATUS_COMPLETED, 'integer') . ' ' .
96 'AND grp_id = ' . $ilDB->quote($a_grp_id, 'integer');
97 $res = $ilDB->query($query);
98 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
99 return $row->num;
100 }
101 return 0;
102 }
const STATUS_COMPLETED
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilSCTask\STATUS_COMPLETED.

Referenced by ilSCGroupTableGUI\parse().

+ Here is the caller graph for this function:

◆ lookupFailed()

static ilSCTasks::lookupFailed (   $a_grp_id)
static

@global type $ilDB

Definition at line 108 of file class.ilSCTasks.php.

109 {
110 global $ilDB;
111
112 $query = 'SELECT count(id) num FROM sysc_tasks ' .
113 'WHERE status = ' . $ilDB->quote(ilSCTask::STATUS_FAILED, 'integer') . ' ' .
114 'AND grp_id = ' . $ilDB->quote($a_grp_id, 'integer');
115 $res = $ilDB->query($query);
116 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117 return $row->num;
118 }
119 return 0;
120 }
const STATUS_FAILED

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilSCTask\STATUS_FAILED.

Referenced by ilSCGroupTableGUI\parse().

+ Here is the caller graph for this function:

◆ lookupGroupId()

static ilSCTasks::lookupGroupId (   $a_task_id)
static

Lookup group id by task id @global type $ilDB.

Parameters
type$a_task_id
Returns
int

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

74 {
75 global $ilDB;
76
77 $query = 'SELECT grp_id FROM sysc_tasks ' .
78 'WHERE id = ' . $ilDB->quote($a_task_id, 'integer');
79 $res = $ilDB->query($query);
80 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
81 return $row->grp_id;
82 }
83 return 0;
84 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilSCComponentTaskFactory\getComponentTask().

+ Here is the caller graph for this function:

◆ lookupLastUpdate()

static ilSCTasks::lookupLastUpdate (   $a_grp_id)
static

Lookup last update of group tasks @global type $ilDB.

Parameters
type$a_grp_id
Returns
\ilDateTime

Definition at line 128 of file class.ilSCTasks.php.

129 {
130 global $ilDB;
131
132 $query = 'SELECT MAX(last_update) last_update FROM sysc_tasks ' .
133 'WHERE status = ' . $ilDB->quote(ilSCTask::STATUS_FAILED, 'integer') . ' ' .
134 'AND grp_id = ' . $ilDB->quote($a_grp_id, 'integer');
135 $res = $ilDB->query($query);
136
137 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
138 return new ilDateTime($row->last_update, IL_CAL_DATETIME, ilTimeZone::UTC);
139 }
140 return new ilDateTime(time(), IL_CAL_UNIX);
141 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, IL_CAL_DATETIME, IL_CAL_UNIX, ilSCTask\STATUS_FAILED, and ilTimeZone\UTC.

Referenced by ilSCGroupTableGUI\parse().

+ Here is the caller graph for this function:

◆ read()

ilSCTasks::read ( )
protected

read groups

Definition at line 160 of file class.ilSCTasks.php.

161 {
162 global $ilDB;
163
164 $query = 'SELECT id FROM sysc_tasks ' .
165 'ORDER BY id ';
166 $res = $ilDB->query($query);
167
168 $this->tasks = array();
169 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
170 $this->tasks[] = new ilSCTask($row->id);
171 }
172 }
Defines a system check task.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ updateFromComponentDefinition()

ilSCTasks::updateFromComponentDefinition (   $a_identifier)

Update from module/service reader.

Parameters
type$a_identifier
Returns
boolean

Definition at line 49 of file class.ilSCTasks.php.

50 {
51 foreach ($this->getTasks() as $task) {
52 if ($task->getIdentifier() == $a_identifier) {
53 return true;
54 }
55 }
56
57 $task = new ilSCTask();
58 $task->setGroupId($this->getGroupId());
59 $task->setIdentifier($a_identifier);
60 $task->create();
61
62 return $task->getId();
63 }
getTasks()
Get groups.

References getGroupId(), and getTasks().

+ Here is the call graph for this function:

Field Documentation

◆ $grp_id

ilSCTasks::$grp_id = 0
private

Definition at line 20 of file class.ilSCTasks.php.

Referenced by getGroupId().

◆ $instances

ilSCTasks::$instances = array()
staticprivate

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

◆ $tasks

ilSCTasks::$tasks = array()
private

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

Referenced by getTasks().


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