ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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(DB_FETCHMODE_OBJECT))
45 {
46 return (string) $row->component;
47 }
48 return '';
49 }
50
51 public function getId()
52 {
53 return $this->id;
54 }
55
56
57 public function setComponentId($a_comp)
58 {
59 $this->component_id = $a_comp;
60 }
61
66 public function getComponentId()
67 {
69 }
70
71
72 public function setLastUpdate(ilDateTime $a_update)
73 {
74 $this->last_update = $a_update;
75 }
76
81 public function getLastUpdate()
82 {
83 if(!$this->last_update)
84 {
85 return $this->last_update = new ilDateTime();
86 }
87 return $this->last_update;
88 }
89
90 public function setStatus($a_status)
91 {
92 $this->status = $a_status;
93 }
94
99 public function getStatus()
100 {
101 return $this->status;
102 }
103
107 public function read()
108 {
109 global $ilDB;
110
111 if(!$this->getId())
112 {
113 return false;
114 }
115
116 $query = 'SELECT * FROM sysc_groups '.
117 'WHERE id = '.$ilDB->quote($this->getId(),'integer');
118 $res = $ilDB->query($query);
119 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
120 {
121 $this->setComponentId($row->component);
122 $this->setLastUpdate(new ilDateTime($row->last_update,IL_CAL_DATETIME,'UTC'));
123 $this->setStatus($row->status);
124 }
125 return true;
126 }
127
131 public function create()
132 {
133 global $ilDB;
134
135 $this->id = $ilDB->nextId('sysc_groups');
136
137 $query = 'INSERT INTO sysc_groups (id,component,status) '.
138 'VALUES ( '.
139 $ilDB->quote($this->getId(),'integer').', '.
140 $ilDB->quote($this->getComponentId(),'text').', '.
141 $ilDB->quote($this->getStatus(),'integer').' '.
142 ')';
143 $ilDB->manipulate($query);
144 return $this->getId();
145 }
146}
147?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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.
global $ilDB