ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 lookupIdentifierForTask ($a_task_id)
 
static lookupGroupId ($a_task_id)
 Lookup group id by task id @global type $ilDB. More...
 
static lookupCompleted ($a_grp_id)
 
static lookupFailed ($a_grp_id)
 
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 168 of file class.ilSCTasks.php.

169 {
170 return $this->grp_id;
171 }

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(), lookupCompleted(), lookupFailed(), and ilSCTaskTableGUI\parse().

+ Here is the caller graph for this function:

◆ getTasks()

ilSCTasks::getTasks ( )

Get groups.

Returns
ilSCTask[]

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

178 {
179 return (array) $this->tasks;
180 }

References $tasks.

Referenced by updateFromComponentDefinition().

+ Here is the caller graph for this function:

◆ lookupCompleted()

static ilSCTasks::lookupCompleted (   $a_grp_id)
static

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

111 {
113
114 $num_completed = 0;
115 foreach ($tasks->getTasks() as $task) {
116 if (!$task->isActive()) {
117 continue;
118 }
119 if ($task->getStatus() == ilSCTask::STATUS_COMPLETED) {
120 $num_completed++;
121 }
122 }
123 return $num_completed;
124 }
const STATUS_COMPLETED
static getInstanceByGroupId($a_group_id)
Get singleton instance.

References $tasks, getInstanceByGroupId(), and ilSCTask\STATUS_COMPLETED.

Referenced by ilSCGroupTableGUI\parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lookupFailed()

static ilSCTasks::lookupFailed (   $a_grp_id)
static

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

129 {
131
132 $num_failed = 0;
133 foreach ($tasks->getTasks() as $task) {
134 if (!$task->isActive()) {
135 continue;
136 }
137
138 if ($task->getStatus() == ilSCTask::STATUS_FAILED) {
139 $num_failed++;
140 }
141 }
142 return $num_failed;
143 }
const STATUS_FAILED

References $tasks, getInstanceByGroupId(), and ilSCTask\STATUS_FAILED.

Referenced by ilSCGroupTableGUI\parse().

+ Here is the call graph for this function:
+ 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 93 of file class.ilSCTasks.php.

94 {
95 global $DIC;
96
97 $ilDB = $DIC['ilDB'];
98
99 $query = 'SELECT grp_id FROM sysc_tasks ' .
100 'WHERE id = ' . $ilDB->quote($a_task_id, 'integer');
101 $res = $ilDB->query($query);
102 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
103 return $row->grp_id;
104 }
105 return 0;
106 }
$row
$query
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB

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

Referenced by ilSCComponentTaskFactory\getComponentTask().

+ Here is the caller graph for this function:

◆ lookupIdentifierForTask()

static ilSCTasks::lookupIdentifierForTask (   $a_task_id)
static
Parameters
int$a_task_id
Returns
string
Exceptions

ilDatabaseException

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

50 {
51 global $DIC;
52
53 $db = $DIC->database();
54 $query = 'select identifier from sysc_tasks ' .
55 'where id = ' . $db->quote($a_task_id, 'integer');
56 $res = $db->query($query);
57 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
58 return $row->identifier;
59 }
60 return '';
61 }

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

Referenced by ilSCComponentTaskFactory\getTask().

+ 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 151 of file class.ilSCTasks.php.

152 {
153 global $DIC;
154
155 $ilDB = $DIC['ilDB'];
156
157 $query = 'SELECT MAX(last_update) last_update FROM sysc_tasks ' .
158 'WHERE status = ' . $ilDB->quote(ilSCTask::STATUS_FAILED, 'integer') . ' ' .
159 'AND grp_id = ' . $ilDB->quote($a_grp_id, 'integer');
160 $res = $ilDB->query($query);
161
162 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163 return new ilDateTime($row->last_update, IL_CAL_DATETIME, ilTimeZone::UTC);
164 }
165 return new ilDateTime(time(), IL_CAL_UNIX);
166 }
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling

References $DIC, $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 185 of file class.ilSCTasks.php.

186 {
187 global $DIC;
188
189 $ilDB = $DIC['ilDB'];
190
191 $query = 'SELECT id, grp_id FROM sysc_tasks ' .
192 'ORDER BY id ';
193 $res = $ilDB->query($query);
194
195 $this->tasks = array();
196 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
197 $this->tasks[] = ilSCComponentTaskFactory::getTask($row->grp_id, $row->id);
198 }
199 }
static getTask($a_group_id, $a_task_id)

References $DIC, $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, and ilSCComponentTaskFactory\getTask().

Referenced by __construct().

+ Here is the call graph for this function:
+ 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 69 of file class.ilSCTasks.php.

70 {
71 foreach ($this->getTasks() as $task) {
72 if ($task->getIdentifier() == $a_identifier) {
73 return true;
74 }
75 }
76
77 $task = new ilSCTask();
78 $task->setGroupId($this->getGroupId());
79 $task->setIdentifier($a_identifier);
80 $task->create();
81
82 return $task->getId();
83 }
Defines a system check task.
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(), lookupCompleted(), and lookupFailed().


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