ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSCGroup.php
Go to the documentation of this file.
1<?php
2
3include_once './Services/Calendar/classes/class.ilDateTime.php';
4
5/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
6
13{
14 private $id = 0;
15 private $component_id = '';
16 private $component_type = '';
17 private $last_update = null;
18 private $status = 0;
19
20
25 public function __construct($a_id = 0)
26 {
27 $this->id = $a_id;
28 $this->read();
29 }
30
37 public static function lookupComponent($a_id)
38 {
39 global $ilDB;
40
41 $query = 'SELECT component FROM sysc_groups ' .
42 'WHERE id = ' . $ilDB->quote($a_id, 'integer');
43 $res = $ilDB->query($query);
44 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
45 return (string) $row->component;
46 }
47 return '';
48 }
49
50 public function getId()
51 {
52 return $this->id;
53 }
54
55
56 public function setComponentId($a_comp)
57 {
58 $this->component_id = $a_comp;
59 }
60
65 public function getComponentId()
66 {
68 }
69
70
71 public function setLastUpdate(ilDateTime $a_update)
72 {
73 $this->last_update = $a_update;
74 }
75
80 public function getLastUpdate()
81 {
82 if (!$this->last_update) {
83 return $this->last_update = new ilDateTime();
84 }
85 return $this->last_update;
86 }
87
88 public function setStatus($a_status)
89 {
90 $this->status = $a_status;
91 }
92
97 public function getStatus()
98 {
99 return $this->status;
100 }
101
105 public function read()
106 {
107 global $ilDB;
108
109 if (!$this->getId()) {
110 return false;
111 }
112
113 $query = 'SELECT * FROM sysc_groups ' .
114 'WHERE id = ' . $ilDB->quote($this->getId(), 'integer');
115 $res = $ilDB->query($query);
116 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
117 $this->setComponentId($row->component);
118 $this->setLastUpdate(new ilDateTime($row->last_update, IL_CAL_DATETIME, ilTimeZone::UTC));
119 $this->setStatus($row->status);
120 }
121 return true;
122 }
123
127 public function create()
128 {
129 global $ilDB;
130
131 $this->id = $ilDB->nextId('sysc_groups');
132
133 $query = 'INSERT INTO sysc_groups (id,component,status) ' .
134 'VALUES ( ' .
135 $ilDB->quote($this->getId(), 'integer') . ', ' .
136 $ilDB->quote($this->getComponentId(), 'text') . ', ' .
137 $ilDB->quote($this->getStatus(), 'integer') . ' ' .
138 ')';
139 $ilDB->manipulate($query);
140 return $this->getId();
141 }
142}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
@classDescription Date and time handling
Defines a system check group including different tasks of a component.
setStatus($a_status)
__construct($a_id=0)
Constructor.
create()
Create new group.
read()
Read group.
getComponentId()
Get component.
getLastUpdate()
Get last update date.
setComponentId($a_comp)
setLastUpdate(ilDateTime $a_update)
static lookupComponent($a_id)
lookup component by id @global type $ilDB
getStatus()
Get status.
$query
foreach($_POST as $key=> $value) $res
global $ilDB