ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjRemoteFile.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 = "rfil_settings";
18 
19  protected $version;
20  protected $version_tstamp;
21 
22  public function initType()
23  {
24  $this->type = "rfil";
25  }
26 
27  protected function getTableName()
28  {
29  return self::DB_TABLE_NAME;
30  }
31 
32  protected function getECSObjectType()
33  {
34  return "/campusconnect/files";
35  }
36 
42  public function setVersion($a_version)
43  {
44  $this->version = (int)$a_version;
45  }
46 
52  public function getVersion()
53  {
54  return $this->version;
55  }
56 
62  public function setVersionDateTime($a_tstamp)
63  {
64  $this->version_tstamp = (int)$a_tstamp;
65  }
66 
72  public function getVersionDateTime()
73  {
74  return $this->version_tstamp;
75  }
76 
77  protected function doCreateCustomFields(array &$a_fields)
78  {
79  $a_fields["version"] = array("integer", 1);
80  $a_fields["version_tstamp"] = array("integer", time());
81  }
82 
83  protected function doUpdateCustomFields(array &$a_fields)
84  {
85  $a_fields["version"] = array("integer", $this->getVersion());
86  $a_fields["version_tstamp"] = array("integer", $this->getVersionDateTime());
87  }
88 
89  protected function doReadCustomFields($a_row)
90  {
91  $this->setVersion($a_row->version);
92  $this->setVersionDateTime($a_row->version_tstamp);
93  }
94 
95  protected function updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
96  {
97  $this->setVersion($a_ecs_content->version);
98  $this->setVersionDateTime($a_ecs_content->version_date);
99  }
100 
109  public static function _lookupVersionInfo($a_obj_id)
110  {
111  global $ilDB;
112 
113  $set = $ilDB->query("SELECT version, version_tstamp".
114  " FROM ".self::DB_TABLE_NAME.
115  " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer"));
116  $row = $ilDB->fetchAssoc($set);
117  $res = (int)$row["version"];
118 
119  if($row["version_tstamp"])
120  {
121  $res .= " (".ilDatePresentation::formatDate(new ilDateTime($row["version_tstamp"], IL_CAL_UNIX)).")";
122  }
123 
124  return $res;
125  }
126 
127  //
128  // no late static binding yet
129  //
130 
131  public static function _lookupMID($a_obj_id)
132  {
133  return ilRemoteObjectBase::_lookupMID($a_obj_id, self::DB_TABLE_NAME);
134  }
135 
136  public static function _lookupOrganization($a_obj_id)
137  {
138  return ilRemoteObjectBase::_lookupOrganization($a_obj_id, self::DB_TABLE_NAME);
139  }
140 }
141 
142 ?>