ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ColorManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Style\Content;
22
25
30{
33 protected \ilObjUser $user;
35 protected int $style_id;
36
37 public function __construct(
38 int $style_id,
40 CharacteristicDBRepo $char_repo,
42 ) {
43 global $DIC;
44
45 $this->user = $DIC->user();
46 $this->characteristic_repo = $char_repo;
47 $this->color_repo = $color_repo;
48 $this->access_manager = $access_manager;
49 $this->style_id = $style_id;
50 }
51
52 public function addColor(
53 string $a_name,
54 string $a_code
55 ): void {
56 $this->color_repo->addColor(
57 $this->style_id,
58 $a_name,
59 $a_code
60 );
61 }
62
66 public function colorExists(
67 string $name
68 ): bool {
69 return $this->color_repo->colorExists(
70 $this->style_id,
71 $name
72 );
73 }
74
78 public function updateColor(
79 string $name,
80 string $new_name,
81 string $code
82 ): void {
83 if (!$this->access_manager->checkWrite()) {
84 throw new ContentStyleNoPermissionException("No write permission for style.");
85 }
86
87 $this->color_repo->updateColor(
88 $this->style_id,
89 $name,
90 $new_name,
91 $code
92 );
93
94 ilObjStyleSheet::_writeUpToDate($this->style_id, false);
95
96 // rename also the name in the style parameter values
97 if ($name != $new_name) {
98 $this->characteristic_repo->updateColorName(
99 $this->style_id,
100 $name,
101 $new_name
102 );
103 }
104 }
105}
Manages access to content style editing.
__construct(int $style_id, Access\StyleAccessManager $access_manager, CharacteristicDBRepo $char_repo, ColorDBRepo $color_repo)
colorExists(string $name)
Check whether color exists.
Access StyleAccessManager $access_manager
CharacteristicDBRepo $characteristic_repo
addColor(string $a_name, string $a_code)
updateColor(string $name, string $new_name, string $code)
Class ilObjStyleSheet.
static _writeUpToDate(int $a_id, bool $a_up_to_date)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26