ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilScorm2004DataSet.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
26 {
27  protected array $temp_dir = array();
28 
34  public function getSupportedVersions(): array
35  {
36  return array("5.1.0");
37  }
38 
39  public function getXmlNamespace(string $a_entity, string $a_schema_version): string
40  {
41  return "http://www.ilias.de/xml/Modules/Scorm2004/" . $a_entity;
42  }
43 
47  protected function getTypes(string $a_entity, string $a_version): array
48  {
49  if ($a_entity === "sahs") {
50  switch ($a_version) {
51  case "5.1.0":
52  return array(
53  "Id" => "integer",
54  "Title" => "text",
55  "Description" => "text",
56  "Editable" => "integer",
57  "Dir" => "directory",
58  "File" => "text"
59  );
60  }
61  }
62  return [];
63  }
64 
65  public function readData(string $a_entity, string $a_version, array $a_ids): void
66  {
67  $ilDB = $this->db;
68 
69  if (!is_array($a_ids)) {
70  $a_ids = array($a_ids);
71  }
72 
73  // sahs
74  if ($a_entity === "sahs") {
75  $this->data = array();
76 
77  switch ($a_version) {
78  case "5.1.0":
79  foreach ($a_ids as $sahs_id) {
80  if (ilObject::_lookupType((int) $sahs_id) === "sahs") {
81  $this->data[] = array("Id" => $sahs_id,
82  "Title" => ilObject::_lookupTitle((int) $sahs_id),
83  "Description" => ilObject::_lookupDescription((int) $sahs_id),
84  "Editable" => 1
85  );
86  }
87  }
88  break;
89  }
90  }
91  }
92 
93 
94 
95  public function afterXmlRecordWriting(string $a_entity, string $a_version, array $a_set): void
96  {
97  if ($a_entity === "sahs") {
98  // delete our temp dir
99  if (isset($this->temp_dir[$a_set["Id"]]) && is_dir($this->temp_dir[$a_set["Id"]])) {
100  ilFileUtils::delDir($this->temp_dir[$a_set["Id"]]);
101  }
102  }
103  }
104 
105 
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
readData(string $a_entity, string $a_version, array $a_ids)
getTypes(string $a_entity, string $a_version)
ilDBInterface $db
static _lookupTitle(int $obj_id)
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static _lookupDescription(int $obj_id)
afterXmlRecordWriting(string $a_entity, string $a_version, array $a_set)
getSupportedVersions()
Note: this is currently used for SCORM authoring lms Get supported versions.
getXmlNamespace(string $a_entity, string $a_schema_version)
static _lookupType(int $id, bool $reference=false)