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 type $ilDB. More...
 
static lookupCompleted ($a_grp_id)
 type $ilDB More...
 
static lookupFailed ($a_grp_id)
 type $ilDB More...
 
static lookupLastUpdate ($a_grp_id)
 Lookup last update of group tasks 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.

References read().

27  {
28  $this->grp_id = $a_grp_id;
29  $this->read();
30  }
read()
read groups
+ Here is the call graph for this function:

Member Function Documentation

◆ getGroupId()

ilSCTasks::getGroupId ( )

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

References $grp_id.

Referenced by updateFromComponentDefinition().

144  {
145  return $this->grp_id;
146  }
+ 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.

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

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

◆ getTasks()

ilSCTasks::getTasks ( )

Get groups.

Returns
ilSCTask[]

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

References $tasks, and array.

Referenced by updateFromComponentDefinition().

153  {
154  return (array) $this->tasks;
155  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ lookupCompleted()

static ilSCTasks::lookupCompleted (   $a_grp_id)
static

type $ilDB

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

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

Referenced by ilSCGroupTableGUI\parse().

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  }
foreach($_POST as $key=> $value) $res
$query
const STATUS_COMPLETED
global $ilDB
+ Here is the caller graph for this function:

◆ lookupFailed()

static ilSCTasks::lookupFailed (   $a_grp_id)
static

type $ilDB

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

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

Referenced by ilSCGroupTableGUI\parse().

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
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupGroupId()

static ilSCTasks::lookupGroupId (   $a_task_id)
static

Lookup group id by task id type $ilDB.

Parameters
type$a_task_id
Returns
int

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

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

Referenced by ilSCComponentTaskFactory\getComponentTask().

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  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupLastUpdate()

static ilSCTasks::lookupLastUpdate (   $a_grp_id)
static

Lookup last update of group tasks type $ilDB.

Parameters
type$a_grp_id
Returns

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

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

Referenced by ilSCGroupTableGUI\parse().

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_DATETIME
const STATUS_FAILED
const IL_CAL_UNIX
foreach($_POST as $key=> $value) $res
Date and time handling
$query
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function:

◆ read()

ilSCTasks::read ( )
protected

read groups

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

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

Referenced by __construct().

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.
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ 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.

References getGroupId(), and getTasks().

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  }
Defines a system check task.
getTasks()
Get groups.
+ 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: