ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjRemoteFile.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
31{
32 public const DB_TABLE_NAME = "rfil_settings";
33
34 protected $version;
35 protected $version_tstamp;
36
37 public function initType(): void
38 {
39 $this->type = "rfil";
40 }
41
42 protected function getTableName(): string
43 {
45 }
46
47 protected function getECSObjectType(): string
48 {
49 return "/campusconnect/files";
50 }
51
57 public function setVersion($a_version)
58 {
59 $this->version = (int) $a_version;
60 }
61
67 public function getVersion()
68 {
69 return $this->version;
70 }
71
77 public function setVersionDateTime($a_tstamp)
78 {
79 $this->version_tstamp = (int) $a_tstamp;
80 }
81
87 public function getVersionDateTime()
88 {
90 }
91
92 protected function doCreateCustomFields(array &$a_fields): void
93 {
94 $a_fields["version"] = array("integer", 1);
95 $a_fields["version_tstamp"] = array("integer", time());
96 }
97
98 protected function doUpdateCustomFields(array &$a_fields): void
99 {
100 $a_fields["version"] = array("integer", $this->getVersion());
101 $a_fields["version_tstamp"] = array("integer", $this->getVersionDateTime());
102 }
103
104 protected function doReadCustomFields($a_row): void
105 {
106 $this->setVersion($a_row->version);
107 $this->setVersionDateTime($a_row->version_tstamp);
108 }
109
110 protected function updateCustomFromECSContent(ilECSSetting $a_server, $ecs_content): void
111 {
112 $this->setVersion($ecs_content->version);
113 $this->setVersionDateTime($ecs_content->version_date);
114 }
115
124 public static function _lookupVersionInfo($a_obj_id)
125 {
126 global $ilDB;
127
128 $set = $ilDB->query("SELECT version, version_tstamp" .
129 " FROM " . self::DB_TABLE_NAME .
130 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer"));
131 $row = $ilDB->fetchAssoc($set);
132 $res = (int) $row["version"];
133
134 if ($row["version_tstamp"]) {
135 $res .= " (" . ilDatePresentation::formatDate(new ilDateTime($row["version_tstamp"], IL_CAL_UNIX)) . ")";
136 }
137
138 return $res;
139 }
140}
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@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.
updateCustomFromECSContent(ilECSSetting $a_server, $ecs_content)
update remote object settings from ecs content
setVersion($a_version)
Set version.
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.
$res
Definition: ltiservices.php:69