ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjRemoteFile.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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  {
44  return self::DB_TABLE_NAME;
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  {
89  return $this->version_tstamp;
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 }
$res
Definition: ltiservices.php:66
setVersion($a_version)
Set version.
Remote file app class.
doCreateCustomFields(array &$a_fields)
doUpdateCustomFields(array &$a_fields)
const IL_CAL_UNIX
static _lookupVersionInfo($a_obj_id)
Get version info.
getVersionDateTime()
get version timestamp
updateCustomFromECSContent(ilECSSetting $a_server, $ecs_content)
Remote object app base class.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
getVersion()
get version
setVersionDateTime($a_tstamp)
Set version timestamp.