58 $this->db =
$DIC->database();
61 $this->log->debug(
"constructed");
62 $this->rbacsystem =
$DIC->rbac()->system();
63 $this->
user = $DIC->user();
64 $this->style_domain =
$DIC->contentStyle()->internal()->domain();
65 $this->content_style_domain =
$DIC->contentStyle()->domain();
66 $this->repo =
$DIC->contentStyle()->internal()->repo();
76 return array(
"10.0",
"8.0",
"5.1.0");
84 public function getXmlNamespace(
string $a_entity,
string $a_schema_version): string
86 return "http://www.ilias.de/xml/Services/Style/" . $a_entity;
95 protected function getTypes(
string $a_entity,
string $a_version): array
97 if ($a_entity ==
"sty") {
104 "Description" =>
"text",
105 "ImagesDir" =>
"directory"
111 "Description" =>
"text",
112 "StyleContainer" =>
"rscontainer"
117 if ($a_entity ==
"object_style") {
118 switch ($a_version) {
123 "ObjectId" =>
"integer"
128 if ($a_entity ==
"sty_setting") {
129 switch ($a_version) {
134 "StyleId" =>
"integer",
141 if ($a_entity ==
"sty_char") {
142 switch ($a_version) {
145 "StyleId" =>
"integer",
147 "Characteristic" =>
"text",
153 "StyleId" =>
"integer",
155 "Characteristic" =>
"text",
157 "OrderNr" =>
"integer",
158 "Outdate" =>
"integer"
163 if ($a_entity ==
"sty_char_title") {
164 switch ($a_version) {
168 "StyleId" =>
"integer",
170 "Characteristic" =>
"text",
177 if ($a_entity ==
"sty_parameter") {
178 switch ($a_version) {
183 "StyleId" =>
"integer",
186 "Parameter" =>
"text",
190 "Custom" =>
"integer"
195 if ($a_entity ==
"sty_color") {
196 switch ($a_version) {
201 "StyleId" =>
"integer",
202 "ColorName" =>
"text",
203 "ColorCode" =>
"text"
208 if ($a_entity ==
"sty_media_query") {
209 switch ($a_version) {
215 "StyleId" =>
"integer",
216 "OrderNr" =>
"integer",
222 if ($a_entity ==
"sty_template") {
223 switch ($a_version) {
229 "StyleId" =>
"integer",
237 if ($a_entity ==
"sty_template_class") {
238 switch ($a_version) {
243 "TemplateId" =>
"integer",
244 "ClassType" =>
"text",
250 if ($a_entity ==
"sty_usage") {
251 switch ($a_version) {
256 "ObjId" =>
"integer",
257 "StyleId" =>
"integer"
268 public function getXmlRecord(
string $a_entity,
string $a_version, array $a_set): array
270 if ($a_entity ==
"sty") {
271 $a_set[
"StyleContainer"] = serialize($this->style_domain->style((
int) $a_set[
"Id"])->getResourceIdentification());
282 public function readData(
string $a_entity,
string $a_version, array $a_ids): void
286 if (!is_array($a_ids)) {
287 $a_ids = array($a_ids);
290 if ($a_entity ==
"object_style") {
291 switch ($a_version) {
295 foreach ($a_ids as
$id) {
296 $this->data[] = array(
"ObjectId" =>
$id);
302 if ($a_entity ==
"sty") {
303 switch ($a_version) {
308 " FROM object_data o " .
309 " WHERE " .
$ilDB->in(
"o.obj_id", $a_ids,
false,
"integer"));
314 if ($a_entity ==
"sty_setting") {
315 switch ($a_version) {
320 " FROM style_setting " .
321 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
326 if ($a_entity ==
"sty_char") {
327 switch ($a_version) {
330 " FROM style_char " .
331 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
336 " FROM style_char " .
337 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
342 if ($a_entity ==
"sty_char_title") {
343 switch ($a_version) {
347 " FROM style_char_title " .
348 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
353 if ($a_entity ==
"sty_parameter") {
354 switch ($a_version) {
359 " FROM style_parameter " .
360 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
365 if ($a_entity ==
"sty_color") {
366 switch ($a_version) {
371 " FROM style_color " .
372 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
377 if ($a_entity ==
"sty_media_query") {
378 switch ($a_version) {
383 " FROM sty_media_query " .
384 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
389 if ($a_entity ==
"sty_template") {
390 switch ($a_version) {
395 " FROM style_template " .
396 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
401 if ($a_entity ==
"sty_template_class") {
402 switch ($a_version) {
407 " FROM style_template_class " .
408 " WHERE " .
$ilDB->in(
"template_id", $a_ids,
false,
"integer"));
413 if ($a_entity ==
"sty_usage") {
414 switch ($a_version) {
419 " FROM style_usage " .
420 " WHERE " .
$ilDB->in(
"style_id", $a_ids,
false,
"integer"));
433 if (
$entity ===
"sty" && $field ===
"StyleContainer") {
434 $rid = $this->style_domain->style((
int) $record[
"Id"])->getResourceIdentification();
436 $container = $this->irss->manageContainer()->getResource($rid);
454 ?array $a_rec =
null,
457 $this->ds_log->debug(
"entity: " . $a_entity .
", rec: " . print_r($a_rec,
true));
460 $this->ds_log->debug(
"object id: " . ($a_rec[
"ObjectId"] ??
null));
461 $style_id = $this->content_style_domain->styleForObjId($a_rec[
"ObjectId"] ?? 0)->getExportStyleId();
462 $this->ds_log->debug(
"style id: " . $style_id);
466 "sty" => array(
"ids" => $style_id));
473 "sty_setting" => array(
"ids" => $a_rec[
"Id"] ??
null),
474 "sty_media_query" => array(
"ids" => $a_rec[
"Id"] ??
null),
475 "sty_char" => array(
"ids" => $a_rec[
"Id"] ??
null),
476 "sty_char_title" => array(
"ids" => $a_rec[
"Id"] ??
null),
477 "sty_color" => array(
"ids" => $a_rec[
"Id"] ??
null),
478 "sty_parameter" => array(
"ids" => $a_rec[
"Id"] ??
null),
479 "sty_template" => array(
"ids" => $a_rec[
"Id"] ??
null),
480 "sty_usage" => array(
"ids" => $a_rec[
"Id"] ??
null)
485 "sty_template_class" => array(
"ids" => $a_rec[
"Id"] ??
null)
502 $access_manager =
$service->domain()->access(
506 $access_manager->enableWrite(
true);
508 $style_id = (isset($this->current_obj))
509 ? $this->current_obj->getId()
511 $characteristic_manager =
$service->domain()->characteristic(
516 $color_manager =
$service->domain()->color(
521 $a_rec = $this->stripTags($a_rec);
524 $this->log->debug(
"Entity: " . $a_entity);
525 if ($new_id = $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_rec[
'Id'])) {
529 $newObj->create(0,
true);
532 $newObj->setTitle($a_rec[
"Title"]);
533 $newObj->setDescription($a_rec[
"Description"]);
534 $newObj->update(
true);
536 $this->current_obj = $newObj;
537 $a_mapping->
addMapping(
"components/ILIAS/Style",
"sty", $a_rec[
"Id"], $newObj->getId());
538 $a_mapping->
addMapping(
"components/ILIAS/ILIASObject",
"obj", $a_rec[
"Id"], $newObj->getId());
539 $this->log->debug(
"Added mapping Services/Style sty " . $a_rec[
"Id"] .
" > " . $newObj->getId());
542 $dir = str_replace(
"..",
"", $a_rec[
"ImagesDir"] ??
"");
543 if ($dir !=
"" && $this->getImportDirectory() !=
"") {
544 $source_dir = $this->getImportDirectory() .
"/" . $dir;
545 $sm = $this->style_domain->style($newObj->getId());
546 $sm->createContainerFromLocalDir($source_dir,
"images",
false);
549 $dir = str_replace(
"..",
"", ($a_rec[
"StyleContainer"] ??
""));
550 if ($dir !=
"" && $this->getImportDirectory() !=
"") {
551 $source_dir = $this->getImportDirectory() .
"/" . $dir;
552 if (is_dir($source_dir)) {
553 $sm = $this->style_domain->style($newObj->getId());
554 $sm->createContainerFromLocalDir($source_dir,
"images",
false);
560 $this->current_obj->writeStyleSetting($a_rec[
"Name"], $a_rec[
"Value"]);
564 $this->current_obj->addCharacteristic($a_rec[
"Type"], $a_rec[
"Characteristic"], $a_rec[
"Hide"], (
int) ($a_rec[
"OrderNr"] ?? 0), (
bool) ($a_rec[
"Outdated"] ??
false));
567 case "sty_char_title":
568 $char_repo = $this->repo->characteristic();
569 $char_repo->addTitle(
570 $this->current_obj->getId(),
572 $a_rec[
"Characteristic"],
578 case "sty_parameter":
579 $mq_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Style",
"media_query", $a_rec[
"MqId"]);
580 $characteristic_manager->replaceParameter($a_rec[
"Tag"], $a_rec[
"Class"], $a_rec[
"Parameter"], $a_rec[
"Value"], $a_rec[
"Type"], $mq_id, $a_rec[
"Custom"]);
584 $color_manager->addColor($a_rec[
"ColorName"], $a_rec[
"ColorCode"]);
587 case "sty_media_query":
588 $mq_id = $this->current_obj->addMediaQuery($a_rec[
"MQuery"], $a_rec[
"OrderNr"]);
589 $a_mapping->
addMapping(
"components/ILIAS/Style",
"media_query", $a_rec[
"Id"], $mq_id);
593 $tid = $this->current_obj->addTemplate($a_rec[
"TempType"], $a_rec[
"Name"], array());
594 $a_mapping->
addMapping(
"components/ILIAS/Style",
"template", $a_rec[
"Id"], $tid);
597 case "sty_template_class":
598 $tid = (
int) $a_mapping->
getMapping(
"components/ILIAS/Style",
"template", $a_rec[
"TemplateId"]);
599 $this->current_obj->addTemplateClass($tid, $a_rec[
"ClassType"], $a_rec[
"Class"]);
603 $obj_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/ILIASObject",
"obj", $a_rec[
"ObjId"]);
604 $style_id = (
int) $a_mapping->
getMapping(
"components/ILIAS/Style",
"sty", $a_rec[
"StyleId"]);
605 if ($obj_id > 0 && $style_id > 0) {
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Class ResourceIdentification.
Facade for consumer domain interface.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getIRSSContainerExportConfig(StorableResource $source_container, string $source_path, string $target_path="")
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 ...
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)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
static writeStyleUsage(int $a_obj_id, int $a_style_id)
Write style usage.
static writeOwner($obj_id, $style_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupType(int $id, bool $reference=false)
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
importRecord(string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
Import record.
Content DomainService $content_style_domain
getXmlRecord(string $a_entity, string $a_version, array $a_set)
Get xml record.
getDependencies(string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
Determine the dependent sets of data.
ilObjStyleSheet $current_obj
readData(string $a_entity, string $a_version, array $a_ids)
Read data.
getXmlNamespace(string $a_entity, string $a_schema_version)
Get xml namespace.
getSupportedVersions()
Get supported versions.
Content InternalDomainService $style_domain
Content InternalRepoService $repo
getContainerExportConfig(array $record, string $entity, string $schema_version, string $field, string $value)
getTypes(string $a_entity, string $a_version)
Get field types for entity.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))