ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSCTasks Class Reference

Description of class. More...

+ Collaboration diagram for ilSCTasks:

Public Member Functions

 updateFromComponentDefinition (string $a_identifier)
 
 getGroupId ()
 
 getTasks ()
 

Static Public Member Functions

static getInstanceByGroupId (int $a_group_id)
 
static lookupIdentifierForTask (int $a_task_id)
 
static lookupGroupId (int $a_task_id)
 
static lookupCompleted (int $a_grp_id)
 
static lookupFailed (int $a_grp_id)
 
static lookupLastUpdate (int $a_grp_id)
 

Protected Member Functions

 read ()
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 __construct (int $a_grp_id)
 

Private Attributes

int $grp_id = 0
 
array $tasks = array()
 

Static Private Attributes

static array $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 24 of file class.ilSCTasks.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCTasks::__construct ( int  $a_grp_id)
private

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

34 {
35 global $DIC;
36
37 $this->db = $DIC->database();
38 $this->grp_id = $a_grp_id;
39 $this->read();
40 }
global $DIC
Definition: shib_login.php:26

References $DIC, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ getGroupId()

ilSCTasks::getGroupId ( )

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

148 : int
149 {
150 return $this->grp_id;
151 }

References $grp_id.

Referenced by updateFromComponentDefinition().

+ Here is the caller graph for this function:

◆ getInstanceByGroupId()

static ilSCTasks::getInstanceByGroupId ( int  $a_group_id)
static

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

42 : ilSCTasks
43 {
44 if (!array_key_exists($a_group_id, self::$instances)) {
45 return self::$instances[$a_group_id] = new self($a_group_id);
46 }
47 return self::$instances[$a_group_id];
48 }
Description of class.

Referenced by ilSystemCheckDefinitionProcessor\beginTag(), lookupCompleted(), lookupFailed(), and ilSCTaskTableGUI\parse().

+ Here is the caller graph for this function:

◆ getTasks()

ilSCTasks::getTasks ( )
Returns
ilSCTask[]

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

156 : array
157 {
158 return $this->tasks;
159 }

References $tasks.

Referenced by updateFromComponentDefinition().

+ Here is the caller graph for this function:

◆ lookupCompleted()

static ilSCTasks::lookupCompleted ( int  $a_grp_id)
static

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

98 : int
99 {
101
102 $num_completed = 0;
103 foreach ($tasks->getTasks() as $task) {
104 if (!$task->isActive()) {
105 continue;
106 }
107 if ($task->getStatus() === ilSCTask::STATUS_COMPLETED) {
108 $num_completed++;
109 }
110 }
111 return $num_completed;
112 }
const STATUS_COMPLETED
static getInstanceByGroupId(int $a_group_id)

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 ( int  $a_grp_id)
static

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

114 : int
115 {
117
118 $num_failed = 0;
119 foreach ($tasks->getTasks() as $task) {
120 if (!$task->isActive()) {
121 continue;
122 }
123
124 if ($task->getStatus() === ilSCTask::STATUS_FAILED) {
125 $num_failed++;
126 }
127 }
128 return $num_failed;
129 }
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 ( int  $a_task_id)
static

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

83 : int
84 {
85 global $DIC;
86
87 $ilDB = $DIC->database();
88
89 $query = 'SELECT grp_id FROM sysc_tasks ' .
90 'WHERE id = ' . $ilDB->quote($a_task_id, ilDBConstants::T_INTEGER);
91 $res = $ilDB->query($query);
92 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
93 return (int) $row->grp_id;
94 }
95 return 0;
96 }
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, $res, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_INTEGER.

Referenced by ilSCComponentTaskFactory\getComponentTask().

+ Here is the caller graph for this function:

◆ lookupIdentifierForTask()

static ilSCTasks::lookupIdentifierForTask ( int  $a_task_id)
static
Exceptions

ilDatabaseException

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

53 : string
54 {
55 global $DIC;
56
57 $db = $DIC->database();
58 $query = 'select identifier from sysc_tasks ' .
59 'where id = ' . $db->quote($a_task_id, ilDBConstants::T_INTEGER);
60 $res = $db->query($query);
61 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
62 return (string) $row->identifier;
63 }
64 return '';
65 }
ilDBInterface $db
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.

References $db, $DIC, $res, ilDBConstants\FETCHMODE_OBJECT, ilDBInterface\query(), ilDBInterface\quote(), and ilDBConstants\T_INTEGER.

Referenced by ilSCComponentTaskFactory\getTask().

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

◆ lookupLastUpdate()

static ilSCTasks::lookupLastUpdate ( int  $a_grp_id)
static

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

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

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

Referenced by ilSCGroupTableGUI\parse().

+ Here is the caller graph for this function:

◆ read()

ilSCTasks::read ( )
protected

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

161 : void
162 {
163 $query = 'SELECT id, grp_id FROM sysc_tasks ' .
164 'ORDER BY id ';
165 $res = $this->db->query($query);
166
167 $this->tasks = array();
168 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
169 $this->tasks[] = ilSCComponentTaskFactory::getTask((int) $row->grp_id, (int) $row->id);
170 }
171 }
static getTask(int $a_group_id, int $a_task_id)

References $res, 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 ( string  $a_identifier)

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

67 : int
68 {
69 foreach ($this->getTasks() as $task) {
70 if ($task->getIdentifier() === $a_identifier) {
71 return 1;
72 }
73 }
74
75 $task = new ilSCTask();
76 $task->setGroupId($this->getGroupId());
77 $task->setIdentifier($a_identifier);
78 $task->create();
79
80 return $task->getId();
81 }
Defines a system check task.

References getGroupId(), and getTasks().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilSCTasks::$db
protected

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

Referenced by lookupIdentifierForTask().

◆ $grp_id

int ilSCTasks::$grp_id = 0
private

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

Referenced by getGroupId().

◆ $instances

array ilSCTasks::$instances = array()
staticprivate

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

◆ $tasks

array ilSCTasks::$tasks = array()
private

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

Referenced by getTasks(), lookupCompleted(), and lookupFailed().


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