4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
42 parent::__construct();
44 $this->log->debug(
"constructed");
55 return array(
"5.1.0");
66 return "http://www.ilias.de/xml/Services/Style/".$a_entity;
76 protected function getTypes($a_entity, $a_version)
78 if ($a_entity ==
"sty")
86 "Description" =>
"text",
87 "ImagesDir" =>
"directory" 92 if ($a_entity ==
"object_style")
98 "ObjectId" =>
"integer" 103 if ($a_entity ==
"sty_setting")
109 "StyleId" =>
"integer",
116 if ($a_entity ==
"sty_char")
122 "StyleId" =>
"integer",
124 "Characteristic" =>
"text",
130 if ($a_entity ==
"sty_parameter")
136 "StyleId" =>
"integer",
139 "Parameter" =>
"text",
143 "Custom" =>
"integer" 148 if ($a_entity ==
"sty_color")
154 "StyleId" =>
"integer",
155 "ColorName" =>
"text",
156 "ColorCode" =>
"text" 161 if ($a_entity ==
"sty_media_query")
168 "StyleId" =>
"integer",
169 "OrderNr" =>
"integer",
175 if ($a_entity ==
"sty_template")
182 "StyleId" =>
"integer",
190 if ($a_entity ==
"sty_template_class")
196 "TemplateId" =>
"integer",
197 "ClassType" =>
"text",
203 if ($a_entity ==
"sty_usage")
209 "ObjId" =>
"integer",
210 "StyleId" =>
"integer" 225 if ($a_entity ==
"sty")
227 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
229 $a_set[
"ImagesDir"] = $dir;
241 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
245 if (!is_array($a_ids))
247 $a_ids =
array($a_ids);
250 if ($a_entity ==
"object_style")
255 foreach ($a_ids as $id)
257 $this->
data[] =
array(
"ObjectId" => $id);
263 if ($a_entity ==
"sty")
269 " FROM object_data o ".
270 " WHERE ".$ilDB->in(
"o.obj_id", $a_ids,
false,
"integer"));
275 if ($a_entity ==
"sty_setting")
281 " FROM style_setting ".
282 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
287 if ($a_entity ==
"sty_char")
294 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
299 if ($a_entity ==
"sty_parameter")
305 " FROM style_parameter ".
306 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
311 if ($a_entity ==
"sty_color")
317 " FROM style_color ".
318 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
323 if ($a_entity ==
"sty_media_query")
329 " FROM sty_media_query ".
330 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
335 if ($a_entity ==
"sty_template")
341 " FROM style_template ".
342 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
347 if ($a_entity ==
"sty_template_class")
353 " FROM style_template_class ".
354 " WHERE ".$ilDB->in(
"template_id", $a_ids,
false,
"integer"));
359 if ($a_entity ==
"sty_usage")
365 " FROM style_usage ".
366 " WHERE ".$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
377 $this->ds_log->debug(
"entity: ".$a_entity.
", rec: ".print_r($a_rec,
true));
381 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
382 $this->ds_log->debug(
"object id: ".$a_rec[
"ObjectId"]);
384 $this->ds_log->debug(
"style id: ".$style_id);
389 "sty" =>
array(
"ids" => $style_id));
396 "sty_setting" =>
array(
"ids" => $a_rec[
"Id"]),
397 "sty_media_query" =>
array(
"ids" => $a_rec[
"Id"]),
398 "sty_char" =>
array(
"ids" => $a_rec[
"Id"]),
399 "sty_color" =>
array(
"ids" => $a_rec[
"Id"]),
400 "sty_parameter" =>
array(
"ids" => $a_rec[
"Id"]),
401 "sty_template" =>
array(
"ids" => $a_rec[
"Id"]),
402 "sty_usage" =>
array(
"ids" => $a_rec[
"Id"])
407 "sty_template_class" =>
array(
"ids" => $a_rec[
"Id"])
421 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
426 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
427 $this->log->debug(
"Entity: ".$a_entity);
428 if($new_id = $a_mapping->getMapping(
'Services/Container',
'objs',$a_rec[
'Id']))
435 $newObj->create(0,
true);
438 $newObj->setTitle($a_rec[
"Title"]);
439 $newObj->setDescription($a_rec[
"Description"]);
440 $newObj->update(
true);
442 $this->current_obj = $newObj;
443 $a_mapping->addMapping(
"Services/Style",
"sty", $a_rec[
"Id"], $newObj->getId());
444 $a_mapping->addMapping(
"Services/Object",
"obj", $a_rec[
"Id"], $newObj->getId());
445 $this->log->debug(
"Added mapping Services/Style sty ".$a_rec[
"Id"].
" > ".$newObj->getId());
447 $dir = str_replace(
"..",
"", $a_rec[
"ImagesDir"]);
457 $this->current_obj->writeStyleSetting($a_rec[
"Name"], $a_rec[
"Value"]);
461 $this->current_obj->addCharacteristic($a_rec[
"Type"], $a_rec[
"Characteristic"], $a_rec[
"Hide"]);
464 case "sty_parameter":
465 $mq_id = (int) $a_mapping->getMapping(
"Services/Style",
"media_query", $a_rec[
"MqId"]);
466 $this->current_obj->replaceStylePar($a_rec[
"Tag"], $a_rec[
"Class"], $a_rec[
"Parameter"], $a_rec[
"Value"], $a_rec[
"Type"], $mq_id, $a_rec[
"Custom"]);
470 $this->current_obj->addColor($a_rec[
"ColorName"], $a_rec[
"ColorCode"]);
473 case "sty_media_query":
474 $mq_id = $this->current_obj->addMediaQuery($a_rec[
"MQuery"], $a_rec[
"OrderNr"]);
475 $a_mapping->addMapping(
"Services/Style",
"media_query", $a_rec[
"Id"], $mq_id);
479 $tid = $this->current_obj->addTemplate($a_rec[
"TempType"], $a_rec[
"Name"],
array());
480 $a_mapping->addMapping(
"Services/Style",
"template", $a_rec[
"Id"], $tid);
483 case "sty_template_class":
484 $tid = (int) $a_mapping->getMapping(
"Services/Style",
"template", $a_rec[
"TemplateId"]);
485 $this->current_obj->addTemplateClass($tid, $a_rec[
"ClassType"], $a_rec[
"Class"]);
489 $obj_id = (int) $a_mapping->getMapping(
"Services/Object",
"obj", $a_rec[
"ObjId"]);
490 $style_id = (int) $a_mapping->getMapping(
"Services/Style",
"sty", $a_rec[
"StyleId"]);
491 if ($obj_id > 0 && $style_id > 0)
493 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.
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
Create styles array
The data for the language used.
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...