ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMediaCastDataSet Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilMediaCastDataSet:
+ Collaboration diagram for ilMediaCastDataSet:

Public Member Functions

 getSupportedVersions ()
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 readData (string $a_entity, string $a_version, array $a_ids)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
 getOrder ()
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 setExportDirectories (string $a_relative, string $a_absolute)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 getDirectDataFromQuery (string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ... More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 

Protected Member Functions

 getTypes (string $a_entity, string $a_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ilObjMediaCast $current_obj
 
array $order = array()
 
- Protected Attributes inherited from ilDataSet
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $relative_export_dir = ""
 
string $absolute_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
int $dircnt = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Media cast data set class

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilMediaCastDataSet.php.

Member Function Documentation

◆ getDependencies()

ilMediaCastDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected

Definition at line 167 of file class.ilMediaCastDataSet.php.

172  : array {
173  return [];
174  }

◆ getOrder()

ilMediaCastDataSet::getOrder ( )

Definition at line 244 of file class.ilMediaCastDataSet.php.

References $order.

244  : array
245  {
246  return $this->order;
247  }

◆ getSupportedVersions()

ilMediaCastDataSet::getSupportedVersions ( )

Definition at line 29 of file class.ilMediaCastDataSet.php.

29  : array
30  {
31  return array("8.0", "5.0.0", "4.1.0");
32  }

◆ getTypes()

ilMediaCastDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

Definition at line 39 of file class.ilMediaCastDataSet.php.

39  : array
40  {
41  if ($a_entity == "mcst") {
42  switch ($a_version) {
43  case "4.1.0":
44  return array(
45  "Id" => "integer",
46  "Title" => "text",
47  "Description" => "text",
48  "PublicFiles" => "integer",
49  "Downloadable" => "integer",
50  "DefaultAccess" => "integer");
51 
52  case "5.0.0":
53  return array(
54  "Id" => "integer",
55  "Title" => "text",
56  "Description" => "text",
57  "PublicFiles" => "integer",
58  "Downloadable" => "integer",
59  "DefaultAccess" => "integer",
60  "Sortmode" => "integer",
61  "Viewmode" => "text",
62  "PublicFeed" => "integer",
63  "KeepRssMin" => "integer",
64  "Order" => "text"
65  );
66 
67  case "8.0":
68  return array(
69  "Id" => "integer",
70  "Title" => "text",
71  "Description" => "text",
72  "PublicFiles" => "integer",
73  "Downloadable" => "integer",
74  "DefaultAccess" => "integer",
75  "Sortmode" => "integer",
76  "Viewmode" => "text",
77  "PublicFeed" => "integer",
78  "KeepRssMin" => "integer",
79  "Order" => "text",
80  "Autoplaymode" => "integer",
81  "NrInitialVideos" => "integer",
82  "NewItemsInLp" => "integer"
83  );
84  }
85  }
86  return [];
87  }

◆ getXmlNamespace()

ilMediaCastDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)

Definition at line 34 of file class.ilMediaCastDataSet.php.

34  : string
35  {
36  return "https://www.ilias.de/xml/Modules/MediaCast/" . $a_entity;
37  }

◆ importRecord()

ilMediaCastDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Definition at line 176 of file class.ilMediaCastDataSet.php.

References ilBlockSetting\_write(), ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), and ilDataSet\stripTags().

182  : void {
183  $a_rec = $this->stripTags($a_rec);
184  switch ($a_entity) {
185  case "mcst":
186 
187  if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
188  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
189  } else {
190  $newObj = new ilObjMediaCast();
191  $newObj->setType("mcst");
192  $newObj->create();
193  }
194 
195  $newObj->setTitle($a_rec["Title"] ?? "");
196  $newObj->setDescription($a_rec["Description"] ?? "");
197  $newObj->setDefaultAccess((int) ($a_rec["DefaultAccess"] ?? 0));
198  $newObj->setDownloadable((bool) (int) ($a_rec["Downloadable"] ?? false));
199  $newObj->setPublicFiles((bool) (int) ($a_rec["PublicFiles"] ?? false));
200 
201  if (in_array($a_schema_version, ["5.0.0", "8.0"])) {
202  $newObj->setOrder((int) ($a_rec["Sortmode"] ?? 0));
203  $newObj->setViewMode((string) ($a_rec["Viewmode"] ?? ""));
204 
205  if ($a_rec["Order"] ?? false) {
206  $this->order[$newObj->getId()] = explode(";", $a_rec["Order"]);
207  }
208 
210  "news",
211  "public_feed",
212  $a_rec["PublicFeed"],
213  0,
214  $newObj->getId()
215  );
216 
218  "news",
219  "keep_rss_min",
220  $a_rec["KeepRssMin"],
221  0,
222  $newObj->getId()
223  );
224  }
225  if (in_array($a_schema_version, ["8.0"])) {
226  $newObj->setAutoplayMode((int) ($a_rec["Autoplaymode"] ?? 0));
227  $newObj->setNumberInitialVideos((int) ($a_rec["NrInitialVideos"] ?? 0));
228  $newObj->setNewItemsInLearningProgress((bool) (int) ($a_rec["NewItemsInLp"] ?? false));
229  }
230 
231  $newObj->update();
232  $this->current_obj = $newObj;
233  $a_mapping->addMapping("Modules/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
234  $a_mapping->addMapping(
235  "Services/News",
236  "news_context",
237  $a_rec["Id"] . ":mcst:0:",
238  $newObj->getId() . ":mcst:0:"
239  );
240  break;
241  }
242  }
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
stripTags(array $rec, array $omit_keys=[])
+ Here is the call graph for this function:

◆ readData()

ilMediaCastDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

Definition at line 89 of file class.ilMediaCastDataSet.php.

References ilDataSet\$db, $ilDB, ilBlockSetting\_lookup(), ilDataSet\getDirectDataFromQuery(), and ILIAS\Repository\int().

93  : void {
94  $ilDB = $this->db;
95 
96 
97  if ($a_entity == "mcst") {
98  switch ($a_version) {
99  case "4.1.0":
100  $this->getDirectDataFromQuery("SELECT id, title, description, " .
101  " public_files, downloadable, def_access default_access" .
102  " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) " .
103  "WHERE " .
104  $ilDB->in("id", $a_ids, false, "integer"));
105  break;
106 
107  case "5.0.0":
108  $this->getDirectDataFromQuery("SELECT id, title, description, " .
109  " public_files, downloadable, def_access default_access, sortmode, viewmode" .
110  " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) " .
111  "WHERE " .
112  $ilDB->in("id", $a_ids, false, "integer"));
113 
114  // #17174 - manual order?
115  $order = array();
116  $set = $ilDB->query("SELECT * FROM il_media_cast_data_ord" .
117  " WHERE " . $ilDB->in("obj_id", $a_ids, false, "integer") .
118  " ORDER BY pos");
119  while ($row = $ilDB->fetchAssoc($set)) {
120  $order[$row["obj_id"]][] = $row["item_id"];
121  }
122 
123  foreach ($this->data as $k => $v) {
124  $this->data[$k]["PublicFeed"] = ilBlockSetting::_lookup("news", "public_feed", 0, $v["Id"]);
125  $this->data[$k]["KeepRssMin"] = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $v["Id"]);
126 
127  // manual order?
128  if ($this->data[$k]["Sortmode"] == 4 &&
129  array_key_exists($v["Id"], $order)) {
130  $this->data[$k]["Order"] = implode(";", $order[$v["Id"]]);
131  }
132  }
133  break;
134 
135  case "8.0":
136  $this->getDirectDataFromQuery("SELECT id, title, description, " .
137  " public_files, downloadable, def_access default_access, sortmode, viewmode," .
138  " autoplaymode,nr_initial_videos,new_items_in_lp" .
139  " FROM il_media_cast_data JOIN object_data ON (il_media_cast_data.id = object_data.obj_id) " .
140  "WHERE " .
141  $ilDB->in("id", $a_ids, false, "integer"));
142 
143  // #17174 - manual order?
144  $order = array();
145  $set = $ilDB->query("SELECT * FROM il_media_cast_data_ord" .
146  " WHERE " . $ilDB->in("obj_id", $a_ids, false, "integer") .
147  " ORDER BY pos");
148  while ($row = $ilDB->fetchAssoc($set)) {
149  $order[$row["obj_id"]][] = $row["item_id"];
150  }
151 
152  foreach ($this->data as $k => $v) {
153  $this->data[$k]["PublicFeed"] = ilBlockSetting::_lookup("news", "public_feed", 0, $v["Id"]);
154  $this->data[$k]["KeepRssMin"] = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $v["Id"]);
155 
156  // manual order?
157  if ($this->data[$k]["Sortmode"] == 4 &&
158  array_key_exists($v["Id"], $order)) {
159  $this->data[$k]["Order"] = implode(";", $order[$v["Id"]]);
160  }
161  }
162  break;
163  }
164  }
165  }
ilDBInterface $db
static _lookup(string $a_type, string $a_setting, int $a_user=0, int $a_block_id=0)
Lookup setting from database.
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
+ Here is the call graph for this function:

Field Documentation

◆ $current_obj

ilObjMediaCast ilMediaCastDataSet::$current_obj
protected

Definition at line 26 of file class.ilMediaCastDataSet.php.

◆ $order

array ilMediaCastDataSet::$order = array()
protected

Definition at line 27 of file class.ilMediaCastDataSet.php.

Referenced by getOrder().


The documentation for this class was generated from the following file: