ILIAS  release_4-4 Revision
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 
4 include_once('Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php');
5 
16 {
17  const DB_TABLE_NAME = "rgrp_settings";
18 
20  const ACTIVATION_OFFLINE = 1;
21  const ACTIVATION_LIMITED = 2;
22 
23  protected $availability_type;
24  protected $end;
25  protected $start;
26 
27  public function initType()
28  {
29  $this->type = "rgrp";
30  }
31 
32  protected function getTableName()
33  {
34  return self::DB_TABLE_NAME;
35  }
36 
37  protected function getECSObjectType()
38  {
39  return "/campusconnect/groups";
40  }
41 
47  public function setAvailabilityType($a_type)
48  {
49  $this->availability_type = $a_type;
50  }
51 
57  public function getAvailabilityType()
58  {
60  }
61 
67  public function setStartingTime($a_time)
68  {
69  $this->start = $a_time;
70  }
71 
77  public function getStartingTime()
78  {
79  return $this->start;
80  }
81 
87  public function setEndingTime($a_time)
88  {
89  $this->end = $a_time;
90  }
91 
97  public function getEndingTime()
98  {
99  return $this->end;
100  }
101 
108  public static function _lookupOnline($a_obj_id)
109  {
110  global $ilDB;
111 
112  $query = "SELECT * FROM ".self::DB_TABLE_NAME.
113  " WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
114  $res = $ilDB->query($query);
115  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
116  switch($row->availability_type)
117  {
118  case self::ACTIVATION_UNLIMITED:
119  return true;
120 
121  case self::ACTIVATION_OFFLINE:
122  return false;
123 
124  case self::ACTIVATION_LIMITED:
125  return time() > $row->r_start && time < $row->r_end;
126 
127  default:
128  return false;
129  }
130 
131  return false;
132  }
133 
134  protected function doCreateCustomFields(array &$a_fields)
135  {
136  $a_fields["availability_type"] = array("integer", 0);
137  $a_fields["availability_start"] = array("integer", 0);
138  $a_fields["availability_end"] = array("integer", 0);
139  }
140 
141  protected function doUpdateCustomFields(array &$a_fields)
142  {
143  $a_fields["availability_type"] = array("integer", $this->getAvailabilityType());
144  $a_fields["availability_start"] = array("integer", (int) $this->getStartingTime());
145  $a_fields["availability_end"] = array("integer", (int) $this->getEndingTime());
146  }
147 
148  protected function doReadCustomFields($a_row)
149  {
150  $this->setAvailabilityType($a_row->availability_type);
151  $this->setStartingTime($a_row->availability_start);
152  $this->setEndingTime($a_row->availability_end);
153  }
154 
155  protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
156  {
157  // add custom values
158  // $this->setAvailabilityType($a_ecs_content->status == 'online' ? self::ACTIVATION_UNLIMITED : self::ACTIVATION_OFFLINE);
159 
160  // :TODO: ACTIVATION_LIMITED is currently not supported in ECS yet
161  }
162 
163 
164  //
165  // no late static binding yet
166  //
167 
168  public static function _lookupMID($a_obj_id)
169  {
170  return ilRemoteObjectBase::_lookupMID($a_obj_id, self::DB_TABLE_NAME);
171  }
172 
173  public static function _lookupOrganization($a_obj_id)
174  {
175  return ilRemoteObjectBase::_lookupOrganization($a_obj_id, self::DB_TABLE_NAME);
176  }
177 }
178 
179 ?>
getEndingTime()
get ending time
setAvailabilityType($a_type)
Set Availability type.
static _lookupOnline($a_obj_id)
Lookup online.
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
getAvailabilityType()
get availability type
static _lookupOrganization($a_obj_id, $a_table)
lookup organization
getStartingTime()
get starting time
doUpdateCustomFields(array &$a_fields)
Remote object app base class.
setEndingTime($a_time)
set ending time
Remote group app class.
updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
static _lookupOrganization($a_obj_id)
doCreateCustomFields(array &$a_fields)
setStartingTime($a_time)
set starting time
static _lookupMID($a_obj_id, $a_table)
lookup owner mid
static _lookupMID($a_obj_id)