ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjRemoteGroup.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 public const DB_TABLE_NAME = "rgrp_settings";
33
35 public const ACTIVATION_OFFLINE = 1;
36 public const ACTIVATION_UNLIMITED = 0;
37 public const ACTIVATION_LIMITED = 2;
38
40 protected $end;
41 protected $start;
42
43 public function initType(): void
44 {
45 $this->type = "rgrp";
46 }
47
48 protected function getTableName(): string
49 {
51 }
52
53 protected function getECSObjectType(): string
54 {
55 return "/campusconnect/groups";
56 }
57
63 public function setAvailabilityType($a_type)
64 {
65 $this->availability_type = $a_type;
66 }
67
73 public function getAvailabilityType()
74 {
76 }
77
83 public function setStartingTime($a_time)
84 {
85 $this->start = $a_time;
86 }
87
93 public function getStartingTime()
94 {
95 return $this->start;
96 }
97
103 public function setEndingTime($a_time)
104 {
105 $this->end = $a_time;
106 }
107
113 public function getEndingTime()
114 {
115 return $this->end;
116 }
117
124 public static function _lookupOnline($a_obj_id)
125 {
126 global $ilDB;
127
128 $query = "SELECT * FROM " . self::DB_TABLE_NAME .
129 " WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
130 $res = $ilDB->query($query);
131 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
132 switch ($row->availability_type) {
134 return true;
135
137 return false;
138
140 return time() > $row->r_start && time < $row->r_end;
141
142 default:
143 return false;
144 }
145
146 return false;
147 }
148
149 protected function doCreateCustomFields(array &$a_fields): void
150 {
151 $a_fields["availability_type"] = array("integer", 0);
152 $a_fields["availability_start"] = array("integer", 0);
153 $a_fields["availability_end"] = array("integer", 0);
154 }
155
156 protected function doUpdateCustomFields(array &$a_fields): void
157 {
158 $a_fields["availability_type"] = array("integer", (int) $this->getAvailabilityType());
159 $a_fields["availability_start"] = array("integer", (int) $this->getStartingTime());
160 $a_fields["availability_end"] = array("integer", (int) $this->getEndingTime());
161 }
162
163 protected function doReadCustomFields($a_row): void
164 {
165 $this->setAvailabilityType($a_row->availability_type);
166 $this->setStartingTime($a_row->availability_start);
167 $this->setEndingTime($a_row->availability_end);
168 }
169
170 protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content): void
171 {
172 // add custom values
173 // $this->setAvailabilityType($a_ecs_content->status == 'online' ? self::ACTIVATION_UNLIMITED : self::ACTIVATION_OFFLINE);
174
175 // :TODO: ACTIVATION_LIMITED is currently not supported in ECS yet
176 }
177}
Remote group app class.
setStartingTime($a_time)
set starting time
getStartingTime()
get starting time
getAvailabilityType()
get availability type
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 _lookupOnline($a_obj_id)
Lookup online.
Remote object app base class.
$res
Definition: ltiservices.php:69