ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 150 of file class.ilSCTasks.php.

References $grp_id.

Referenced by updateFromComponentDefinition().

151  {
152  return $this->grp_id;
153  }
+ 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  {
40  return self::$instances[$a_group_id] = new self($a_group_id);
41  }
42  return self::$instances[$a_group_id];
43  }
+ Here is the caller graph for this function:

◆ getTasks()

ilSCTasks::getTasks ( )

Get groups.

Returns
ilSCTask[]

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

References $tasks, and array.

Referenced by updateFromComponentDefinition().

160  {
161  return (array) $this->tasks;
162  }
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 94 of file class.ilSCTasks.php.

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

Referenced by ilSCGroupTableGUI\parse().

95  {
96  global $ilDB;
97 
98  $query = 'SELECT count(id) num FROM sysc_tasks '.
99  'WHERE status = '.$ilDB->quote(ilSCTask::STATUS_COMPLETED,'integer').' '.
100  'AND grp_id = '.$ilDB->quote($a_grp_id,'integer');
101  $res = $ilDB->query($query);
102  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
103  {
104  return $row->num;
105  }
106  return 0;
107  }
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 113 of file class.ilSCTasks.php.

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

Referenced by ilSCGroupTableGUI\parse().

114  {
115  global $ilDB;
116 
117  $query = 'SELECT count(id) num FROM sysc_tasks '.
118  'WHERE status = '.$ilDB->quote(ilSCTask::STATUS_FAILED,'integer').' '.
119  'AND grp_id = '.$ilDB->quote($a_grp_id,'integer');
120  $res = $ilDB->query($query);
121  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
122  {
123  return $row->num;
124  }
125  return 0;
126  }
const STATUS_FAILED
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 76 of file class.ilSCTasks.php.

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

Referenced by ilSCComponentTaskFactory\getComponentTask().

77  {
78  global $ilDB;
79 
80  $query = 'SELECT grp_id FROM sysc_tasks '.
81  'WHERE id = '.$ilDB->quote($a_task_id,'integer');
82  $res = $ilDB->query($query);
83  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
84  {
85  return $row->grp_id;
86  }
87  return 0;
88  }
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 134 of file class.ilSCTasks.php.

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

Referenced by ilSCGroupTableGUI\parse().

135  {
136  global $ilDB;
137 
138  $query = 'SELECT MAX(last_update) last_update FROM sysc_tasks '.
139  'WHERE status = '.$ilDB->quote(ilSCTask::STATUS_FAILED,'integer').' '.
140  'AND grp_id = '.$ilDB->quote($a_grp_id,'integer');
141  $res = $ilDB->query($query);
142 
143  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
144  {
145  return new ilDateTime($row->last_update,IL_CAL_DATETIME,'UTC');
146  }
147  return new ilDateTime(time(),IL_CAL_UNIX);
148  }
const IL_CAL_DATETIME
const STATUS_FAILED
const IL_CAL_UNIX
Date and time handling
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 167 of file class.ilSCTasks.php.

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

Referenced by __construct().

168  {
169  global $ilDB;
170 
171  $query = 'SELECT id FROM sysc_tasks '.
172  'ORDER BY id ';
173  $res = $ilDB->query($query);
174 
175  $this->tasks = array();
176  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
177  {
178  $this->tasks[] = new ilSCTask($row->id);
179  }
180  }
Defines a system check task.
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 50 of file class.ilSCTasks.php.

References getGroupId(), and getTasks().

51  {
52  foreach($this->getTasks() as $task)
53  {
54  if($task->getIdentifier() == $a_identifier)
55  {
56  return TRUE;
57  }
58  }
59 
60  $task = new ilSCTask();
61  $task->setGroupId($this->getGroupId());
62  $task->setIdentifier($a_identifier);
63  $task->create();
64 
65  return $task->getId();
66  }
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: