ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References $DIC, and read().

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:22
+ Here is the call graph for this function:

Member Function Documentation

◆ getGroupId()

ilSCTasks::getGroupId ( )

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

References $grp_id.

Referenced by updateFromComponentDefinition().

148  : int
149  {
150  return $this->grp_id;
151  }
+ 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.

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

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.
+ Here is the caller graph for this function:

◆ getTasks()

ilSCTasks::getTasks ( )
Returns
ilSCTask[]

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

References $tasks.

Referenced by updateFromComponentDefinition().

156  : array
157  {
158  return $this->tasks;
159  }
+ 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.

References ilSCTask\STATUS_COMPLETED.

Referenced by ilSCGroupTableGUI\parse().

98  : int
99  {
100  $tasks = self::getInstanceByGroupId($a_grp_id);
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
+ 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.

References ilSCTask\STATUS_FAILED.

Referenced by ilSCGroupTableGUI\parse().

114  : int
115  {
116  $tasks = self::getInstanceByGroupId($a_grp_id);
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
+ 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.

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

Referenced by ilSCComponentTaskFactory\getComponentTask().

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:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupIdentifierForTask()

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

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

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

Referenced by ilSCComponentTaskFactory\getTask().

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  }
$res
Definition: ltiservices.php:66
ilDBInterface $db
quote($value, string $type)
global $DIC
Definition: shib_login.php:22
query(string $query)
Run a (read-only) Query on the database.
+ 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.

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().

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  }
$res
Definition: ltiservices.php:66
const IL_CAL_DATETIME
const STATUS_FAILED
const IL_CAL_UNIX
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ read()

ilSCTasks::read ( )
protected

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

References $res, ilDBConstants\FETCHMODE_OBJECT, and ilSCComponentTaskFactory\getTask().

Referenced by __construct().

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  }
$res
Definition: ltiservices.php:66
static getTask(int $a_group_id, int $a_task_id)
+ 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.

References getGroupId(), and getTasks().

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.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilSCTasks::$db
protected

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

◆ $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().


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