4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
44 $this->db = $DIC->database();
45 parent::__construct();
47 $this->log->debug(
"constructed");
58 return array(
"5.1.0");
69 return "http://www.ilias.de/xml/Services/Style/" . $a_entity;
79 protected function getTypes($a_entity, $a_version)
81 if ($a_entity ==
"sty") {
87 "Description" =>
"text",
88 "ImagesDir" =>
"directory" 93 if ($a_entity ==
"object_style") {
97 "ObjectId" =>
"integer" 102 if ($a_entity ==
"sty_setting") {
103 switch ($a_version) {
106 "StyleId" =>
"integer",
113 if ($a_entity ==
"sty_char") {
114 switch ($a_version) {
117 "StyleId" =>
"integer",
119 "Characteristic" =>
"text",
125 if ($a_entity ==
"sty_parameter") {
126 switch ($a_version) {
129 "StyleId" =>
"integer",
132 "Parameter" =>
"text",
136 "Custom" =>
"integer" 141 if ($a_entity ==
"sty_color") {
142 switch ($a_version) {
145 "StyleId" =>
"integer",
146 "ColorName" =>
"text",
147 "ColorCode" =>
"text" 152 if ($a_entity ==
"sty_media_query") {
153 switch ($a_version) {
157 "StyleId" =>
"integer",
158 "OrderNr" =>
"integer",
164 if ($a_entity ==
"sty_template") {
165 switch ($a_version) {
169 "StyleId" =>
"integer",
177 if ($a_entity ==
"sty_template_class") {
178 switch ($a_version) {
181 "TemplateId" =>
"integer",
182 "ClassType" =>
"text",
188 if ($a_entity ==
"sty_usage") {
189 switch ($a_version) {
192 "ObjId" =>
"integer",
193 "StyleId" =>
"integer" 207 if ($a_entity ==
"sty") {
208 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
210 $a_set[
"ImagesDir"] = $dir;
222 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
226 if (!is_array($a_ids)) {
227 $a_ids = array($a_ids);
230 if ($a_entity ==
"object_style") {
231 switch ($a_version) {
233 foreach ($a_ids as
$id) {
234 $this->
data[] = array(
"ObjectId" => $id);
240 if ($a_entity ==
"sty") {
241 switch ($a_version) {
244 " FROM object_data o " .
245 " WHERE " .
$ilDB->in(
"o.obj_id", $a_ids,
false,
"integer"));
250 if ($a_entity ==
"sty_setting") {
251 switch ($a_version) {
254 " FROM style_setting " .
255 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
260 if ($a_entity ==
"sty_char") {
261 switch ($a_version) {
264 " FROM style_char " .
265 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
270 if ($a_entity ==
"sty_parameter") {
271 switch ($a_version) {
274 " FROM style_parameter " .
275 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
280 if ($a_entity ==
"sty_color") {
281 switch ($a_version) {
284 " FROM style_color " .
285 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
290 if ($a_entity ==
"sty_media_query") {
291 switch ($a_version) {
294 " FROM sty_media_query " .
295 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
300 if ($a_entity ==
"sty_template") {
301 switch ($a_version) {
304 " FROM style_template " .
305 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
310 if ($a_entity ==
"sty_template_class") {
311 switch ($a_version) {
314 " FROM style_template_class " .
315 " WHERE " .
$ilDB->in(
"template_id", $a_ids,
false,
"integer"));
320 if ($a_entity ==
"sty_usage") {
321 switch ($a_version) {
324 " FROM style_usage " .
325 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
336 $this->ds_log->debug(
"entity: " . $a_entity .
", rec: " . print_r($a_rec,
true));
339 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
340 $this->ds_log->debug(
"object id: " . $a_rec[
"ObjectId"]);
342 $this->ds_log->debug(
"style id: " . $style_id);
346 "sty" => array(
"ids" => $style_id));
353 "sty_setting" => array(
"ids" => $a_rec[
"Id"]),
354 "sty_media_query" => array(
"ids" => $a_rec[
"Id"]),
355 "sty_char" => array(
"ids" => $a_rec[
"Id"]),
356 "sty_color" => array(
"ids" => $a_rec[
"Id"]),
357 "sty_parameter" => array(
"ids" => $a_rec[
"Id"]),
358 "sty_template" => array(
"ids" => $a_rec[
"Id"]),
359 "sty_usage" => array(
"ids" => $a_rec[
"Id"])
364 "sty_template_class" => array(
"ids" => $a_rec[
"Id"])
378 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
382 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
383 $this->log->debug(
"Entity: " . $a_entity);
384 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_rec[
'Id'])) {
388 $newObj->create(0,
true);
391 $newObj->setTitle($a_rec[
"Title"]);
392 $newObj->setDescription($a_rec[
"Description"]);
393 $newObj->update(
true);
395 $this->current_obj = $newObj;
396 $a_mapping->addMapping(
"Services/Style",
"sty", $a_rec[
"Id"], $newObj->getId());
397 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
398 $this->log->debug(
"Added mapping Services/Style sty " . $a_rec[
"Id"] .
" > " . $newObj->getId());
400 $dir = str_replace(
"..",
"", $a_rec[
"ImagesDir"]);
409 $this->current_obj->writeStyleSetting($a_rec[
"Name"], $a_rec[
"Value"]);
413 $this->current_obj->addCharacteristic($a_rec[
"Type"], $a_rec[
"Characteristic"], $a_rec[
"Hide"]);
416 case "sty_parameter":
417 $mq_id = (int) $a_mapping->getMapping(
"Services/Style",
"media_query", $a_rec[
"MqId"]);
418 $this->current_obj->replaceStylePar($a_rec[
"Tag"], $a_rec[
"Class"], $a_rec[
"Parameter"], $a_rec[
"Value"], $a_rec[
"Type"], $mq_id, $a_rec[
"Custom"]);
422 $this->current_obj->addColor($a_rec[
"ColorName"], $a_rec[
"ColorCode"]);
425 case "sty_media_query":
426 $mq_id = $this->current_obj->addMediaQuery($a_rec[
"MQuery"], $a_rec[
"OrderNr"]);
427 $a_mapping->addMapping(
"Services/Style",
"media_query", $a_rec[
"Id"], $mq_id);
431 $tid = $this->current_obj->addTemplate($a_rec[
"TempType"], $a_rec[
"Name"], array());
432 $a_mapping->addMapping(
"Services/Style",
"template", $a_rec[
"Id"], $tid);
435 case "sty_template_class":
436 $tid = (int) $a_mapping->getMapping(
"Services/Style",
"template", $a_rec[
"TemplateId"]);
437 $this->current_obj->addTemplateClass($tid, $a_rec[
"ClassType"], $a_rec[
"Class"]);
441 $obj_id = (int) $a_mapping->getMapping(
"Services/Object",
"obj", $a_rec[
"ObjId"]);
442 $style_id = (int) $a_mapping->getMapping(
"Services/Style",
"sty", $a_rec[
"StyleId"]);
443 if ($obj_id > 0 && $style_id > 0) {
444 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
if(!array_key_exists('StateId', $_REQUEST)) $id
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getImportDirectory()
Get import directory.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
getSupportedVersions()
Get supported versions.
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getImagesDirectory($a_style_id)
Get images directory.
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record.
static getLogger($a_component_id)
Get component logger.
getTypes($a_entity, $a_version)
Get field types for entity.
A dataset contains in data in a common structure that can be shared and transformed for different pur...