ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
4include_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 {
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 {
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}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
Remote file app class.
doUpdateCustomFields(array &$a_fields)
Add custom fields to db update.
getVersionDateTime()
get version timestamp
doCreateCustomFields(array &$a_fields)
Add custom fields to db insert.
getTableName()
Get db table name.
setVersion($a_version)
Set version.
updateCustomFromECSContent(ilECSSetting $a_server, $a_ecs_content)
update remote object settings from ecs content
doReadCustomFields($a_row)
Read custom fields from db row.
getECSObjectType()
Get ECS resource identifier, e.g.
static _lookupVersionInfo($a_obj_id)
Get version info.
setVersionDateTime($a_tstamp)
Set version timestamp.
Remote object app base class.
foreach($_POST as $key=> $value) $res
global $ilDB