ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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  $res .= " (" . ilDatePresentation::formatDate(new ilDateTime($row["version_tstamp"], IL_CAL_UNIX)) . ")";
121  }
122 
123  return $res;
124  }
125 }
setVersion($a_version)
Set version.
Remote file app class.
doCreateCustomFields(array &$a_fields)
doUpdateCustomFields(array &$a_fields)
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static _lookupVersionInfo($a_obj_id)
Get version info.
getVersionDateTime()
get version timestamp
foreach($_POST as $key=> $value) $res
updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
Date and time handling
Remote object app base class.
$row
global $ilDB
getVersion()
get version
setVersionDateTime($a_tstamp)
Set version timestamp.