ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjRemoteGroup.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once('Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php');
5
16{
17 const DB_TABLE_NAME = "rgrp_settings";
18
23
25 protected $end;
26 protected $start;
27
28 public function initType()
29 {
30 $this->type = "rgrp";
31 }
32
33 protected function getTableName()
34 {
36 }
37
38 protected function getECSObjectType()
39 {
40 return "/campusconnect/groups";
41 }
42
48 public function setAvailabilityType($a_type)
49 {
50 $this->availability_type = $a_type;
51 }
52
58 public function getAvailabilityType()
59 {
61 }
62
68 public function setStartingTime($a_time)
69 {
70 $this->start = $a_time;
71 }
72
78 public function getStartingTime()
79 {
80 return $this->start;
81 }
82
88 public function setEndingTime($a_time)
89 {
90 $this->end = $a_time;
91 }
92
98 public function getEndingTime()
99 {
100 return $this->end;
101 }
102
109 public static function _lookupOnline($a_obj_id)
110 {
111 global $ilDB;
112
113 $query = "SELECT * FROM ".self::DB_TABLE_NAME.
114 " WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
115 $res = $ilDB->query($query);
116 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
117 switch($row->availability_type)
118 {
120 return true;
121
123 return false;
124
126 return time() > $row->r_start && time < $row->r_end;
127
128 default:
129 return false;
130 }
131
132 return false;
133 }
134
135 protected function doCreateCustomFields(array &$a_fields)
136 {
137 $a_fields["availability_type"] = array("integer", 0);
138 $a_fields["availability_start"] = array("integer", 0);
139 $a_fields["availability_end"] = array("integer", 0);
140 }
141
142 protected function doUpdateCustomFields(array &$a_fields)
143 {
144 $a_fields["availability_type"] = array("integer", $this->getAvailabilityType());
145 $a_fields["availability_start"] = array("integer", (int) $this->getStartingTime());
146 $a_fields["availability_end"] = array("integer", (int) $this->getEndingTime());
147 }
148
149 protected function doReadCustomFields($a_row)
150 {
151 $this->setAvailabilityType($a_row->availability_type);
152 $this->setStartingTime($a_row->availability_start);
153 $this->setEndingTime($a_row->availability_end);
154 }
155
156 protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
157 {
158 // add custom values
159 // $this->setAvailabilityType($a_ecs_content->status == 'online' ? self::ACTIVATION_UNLIMITED : self::ACTIVATION_OFFLINE);
160
161 // :TODO: ACTIVATION_LIMITED is currently not supported in ECS yet
162 }
163
164
165 //
166 // no late static binding yet
167 //
168
169 public static function _lookupMID($a_obj_id)
170 {
171 return ilRemoteObjectBase::_lookupMID($a_obj_id, self::DB_TABLE_NAME);
172 }
173
174 public static function _lookupOrganization($a_obj_id)
175 {
176 return ilRemoteObjectBase::_lookupOrganization($a_obj_id, self::DB_TABLE_NAME);
177 }
178}
179
180?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
Remote group app class.
setStartingTime($a_time)
set starting time
getStartingTime()
get starting time
getAvailabilityType()
get availability type
doReadCustomFields($a_row)
Read custom fields from db row.
setAvailabilityType($a_type)
Set Availability type.
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
update remote object settings from ecs content
getTableName()
Get db table name.
getECSObjectType()
Get ECS resource identifier, e.g.
const ACTIVATION_OFFLINE
Fixed activation.
getEndingTime()
get ending time
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.
setEndingTime($a_time)
set ending time
static _lookupOrganization($a_obj_id)
static _lookupMID($a_obj_id)
static _lookupOnline($a_obj_id)
Lookup online.
Remote object app base class.
static _lookupOrganization($a_obj_id, $a_table)
lookup organization
static _lookupMID($a_obj_id, $a_table)
lookup owner mid
global $ilDB