ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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)
 Read data from DB. More...
 
 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...
 
 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...
 
 initByExporter (ilXmlExporter $xml_exporter)
 
 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 ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> 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...
 
 getCollection (array $record, string $entity, string $schema_version, string $field, string $value)
 
 getContainerExportConfig (array $record, string $entity, string $schema_version, string $field, string $value)
 

Protected Member Functions

 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 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)
 
 getExportDirInContainer (string $exp_dir)
 
 getIRSSContainerExportConfig (StorableResource $source_container, string $source_path, string $target_path="")
 
 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
ILIAS ResourceStorage Services $irss
 
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $component_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 
ilExport $export
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const DATASET_NS = 'http://www.ilias.de/Services/DataSet/ds/4_3'
 
const DATASET_NS_PREFIX = 'ds'
 
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

Reimplemented from ilDataSet.

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

172 : array {
173 return [];
174 }

◆ getOrder()

ilMediaCastDataSet::getOrder ( )

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

252 : array
253 {
254 return $this->order;
255 }

◆ getSupportedVersions()

ilMediaCastDataSet::getSupportedVersions ( )

Reimplemented from ilDataSet.

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

Get (abstract) types for (abstract) field names.

Please note that the abstract fields/types only depend on the version! Not on a choosen representation!

Returns
array types array, e.g. array("field_1" => "text", "field_2" => "integer", ...)

Reimplemented from ilDataSet.

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 
)

Reimplemented from ilDataSet.

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 
)

Needs to be overwritten for import use case.

Reimplemented from ilDataSet.

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

182 : void {
183 $a_rec = $this->stripTags($a_rec);
184 switch ($a_entity) {
185 case "mcst":
186
187 if ($new_id = $a_mapping->getMapping('components/ILIAS/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 $a_mapping->addMapping("components/ILIAS/ILIASObject", "obj", $a_rec["Id"], $newObj->getId());
202
203 if (in_array($a_schema_version, ["5.0.0", "8.0"])) {
204 $newObj->setOrder((int) ($a_rec["Sortmode"] ?? 0));
205 $newObj->setViewMode((string) ($a_rec["Viewmode"] ?? ""));
206
207 if ($a_rec["Order"] ?? false) {
208 $this->order[$newObj->getId()] = explode(";", $a_rec["Order"]);
209 }
210
212 "news",
213 "public_feed",
214 $a_rec["PublicFeed"],
215 0,
216 $newObj->getId()
217 );
218
220 "news",
221 "keep_rss_min",
222 $a_rec["KeepRssMin"],
223 0,
224 $newObj->getId()
225 );
226 }
227 if (in_array($a_schema_version, ["8.0"])) {
228 $newObj->setAutoplayMode((int) ($a_rec["Autoplaymode"] ?? 0));
229 $newObj->setNumberInitialVideos((int) ($a_rec["NrInitialVideos"] ?? 0));
230 $newObj->setNewItemsInLearningProgress((bool) (int) ($a_rec["NewItemsInLp"] ?? false));
231 }
232
233 $newObj->update();
234 $this->current_obj = $newObj;
235 $a_mapping->addMapping("components/ILIAS/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
236 $a_mapping->addMapping(
237 "components/ILIAS/News",
238 "news_context",
239 $a_rec["Id"] . ":mcst:0:",
240 $newObj->getId() . ":mcst:0:"
241 );
242 $a_mapping->addMapping(
243 "components/ILIAS/MetaData",
244 "md",
245 $a_rec["Id"] . ":0:mcst",
246 $newObj->getId() . ":0:mcst"
247 );
248 break;
249 }
250 }
static _write(string $a_type, string $a_setting, string $a_value, int $a_user=0, int $a_block_id=0)
Write setting to database.
stripTags(array $rec, array $omit_keys=[])
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 getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id

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

+ Here is the call graph for this function:

◆ readData()

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

Read data from DB.

This should result in the abstract field structure of the version set in the constructor.

Reimplemented from ilDataSet.

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

93 : void {
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 }
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 ...
ilDBInterface $db

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

+ 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 readData().


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