ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjRemoteGlossary.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 = "rglo_settings";
18 
19  const ACTIVATION_OFFLINE = 0;
20  const ACTIVATION_ONLINE = 1;
21 
22  protected $availability_type;
23 
24  public function initType()
25  {
26  $this->type = "rglo";
27  }
28 
29  protected function getTableName()
30  {
31  return self::DB_TABLE_NAME;
32  }
33 
34  protected function getECSObjectType()
35  {
36  return "/campusconnect/glossaries";
37  }
38 
44  public function setAvailabilityType($a_type)
45  {
46  $this->availability_type = $a_type;
47  }
48 
54  public function getAvailabilityType()
55  {
57  }
58 
65  public static function _lookupOnline($a_obj_id)
66  {
67  global $ilDB;
68 
69  $query = "SELECT * FROM ".self::DB_TABLE_NAME.
70  " WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
71  $res = $ilDB->query($query);
72  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
73  switch($row->availability_type)
74  {
75  case self::ACTIVATION_ONLINE:
76  return true;
77 
78  case self::ACTIVATION_OFFLINE:
79  return false;
80 
81  default:
82  return false;
83  }
84 
85  return false;
86  }
87 
88  protected function doCreateCustomFields(array &$a_fields)
89  {
90  $a_fields["availability_type"] = array("integer", 0);
91  }
92 
93  protected function doUpdateCustomFields(array &$a_fields)
94  {
95  $a_fields["availability_type"] = array("integer", $this->getAvailabilityType());
96  }
97 
98  protected function doReadCustomFields($a_row)
99  {
100  $this->setAvailabilityType($a_row->availability_type);
101  }
102 
103  protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
104  {
105  $this->setAvailabilityType($a_ecs_content->availability == 'online' ? self::ACTIVATION_ONLINE : self::ACTIVATION_OFFLINE);
106  }
107 
108  //
109  // no late static binding yet
110  //
111 
112  public static function _lookupMID($a_obj_id)
113  {
114  return ilRemoteObjectBase::_lookupMID($a_obj_id, self::DB_TABLE_NAME);
115  }
116 
117  public static function _lookupOrganization($a_obj_id)
118  {
119  return ilRemoteObjectBase::_lookupOrganization($a_obj_id, self::DB_TABLE_NAME);
120  }
121 }
122 
123 ?>