3 declare(strict_types=1);
49 $this->repo = $char_repo;
52 $this->session = $char_copy_paste_repo;
61 $this->repo->addCharacteristic(
78 return $this->repo->exists(
90 string $characteristic
92 return $this->repo->getByKey(
105 return $this->repo->getByType(
116 bool $include_hidden =
true,
117 bool $include_outdated =
true 119 return $this->repo->getByTypes(
133 return $this->repo->getBySuperType(
144 string $characteristic,
145 bool $fallback_to_characteristic =
true 147 $char = $this->repo->getByKey(
153 $titles = $char ? $char->getTitles() : [];
157 if (($titles[
$lang] ??
"") !=
"") {
158 return $titles[
$lang];
160 if ($fallback_to_characteristic) {
161 return $characteristic;
172 string $characteristic,
175 if (!$this->access_manager->checkWrite()) {
178 $this->repo->saveTitles(
191 string $characteristic,
194 if (!$this->access_manager->checkWrite()) {
197 $this->repo->saveHidden(
210 string $characteristic,
213 if (!$this->access_manager->checkWrite()) {
216 $this->repo->saveOutdated(
226 string $characteristic
228 return $this->repo->isOutdated(
243 if (!$this->access_manager->checkWrite()) {
247 asort($order_nrs, SORT_NUMERIC);
249 foreach ($order_nrs as $char => $nr) {
250 $this->repo->saveOrderNr(
268 if (!$this->access_manager->checkWrite()) {
275 if (empty($core_styles[$type .
"." . $tag .
"." . $class])) {
276 $this->repo->deleteCharacteristic(
289 array $characteristics
291 $this->session->set($this->style_id, $style_type, $characteristics);
299 return $this->session->hasEntries($style_type);
304 $this->session->clear();
309 $data = $this->session->getData();
310 return (
int)
$data->style_id;
315 $data = $this->session->getData();
316 return $data->style_type;
321 $data = $this->session->getData();
322 return $data->characteristics;
330 int $source_style_id,
331 string $source_style_type,
336 if (!$this->access_manager->checkWrite()) {
340 if ($this->
exists($source_style_type, $new_char)) {
341 $target_char = $this->
getByKey($source_style_type, $new_char);
342 if (count($new_titles) == 0) {
343 $new_titles = $target_char->getTitles();
349 $this->
saveTitles($source_style_type, $new_char, $new_titles);
354 $pars = $from_style->getParametersOfClass($source_style_type, $source_char);
357 foreach ($pars as $p => $v) {
358 if (substr($v, 0, 1) ==
"!") {
359 $colors[] = substr($v, 1);
371 foreach ($colors as
$c) {
372 if (!$this->color_repo->colorExists($this->style_id, $c)) {
373 $this->color_repo->addColor(
376 $from_style->getColorCodeForName($c)
389 bool $a_custom =
false 392 $this->repo->replaceParameter(
420 bool $a_custom =
false 422 $this->repo->deleteParameter(
deleteCharacteristic(string $type, string $class)
Delete Characteristic.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isOutdated(string $type, string $characteristic)
getCopyCharacteristicStyleId()
No permission for style exception.
hasCopiedCharacteristics(string $style_type)
Is in copy process?
getCopyCharacteristicStyleType()
Access StyleAccessManager $access_manager
CharacteristicDBRepo $repo
exists(string $type, string $char)
Check if characteristic exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $style_id, Access\StyleAccessManager $access_manager, CharacteristicDBRepo $char_repo, CharacteristicCopyPasteSessionRepo $char_copy_paste_repo, ColorDBRepo $color_repo, ilObjUser $user)
getByType(string $type)
Get characteristics by type.
replaceParameter(string $a_tag, string $a_class, string $a_par, string $a_val, string $a_type, int $a_mq_id=0, bool $a_custom=false)
addCharacteristic(string $type, string $char, bool $hidden=false)
static _writeUpToDate(int $a_id, bool $a_up_to_date)
getBySuperType(string $supertype)
Get characteristics by supertype.
deleteParameter(string $a_tag, string $a_class, string $a_par, string $a_type, int $a_mq_id=0, bool $a_custom=false)
getByKey(string $type, string $characteristic)
Get characteristic by key.
Main business logic for characteristics.
saveOutdated(string $type, string $characteristic, bool $outdated)
Save characteristic outdated status.
Characteristic (Class) of style.
getByTypes(array $types, bool $include_hidden=true, bool $include_outdated=true)
Get characteristics by type.
setCopyCharacteristics(string $style_type, array $characteristics)
saveHidden(string $type, string $characteristic, bool $hide)
Save characteristic hidden status.
saveOrderNrs(string $type, array $order_nrs)
Save characteristics order.
Manages access to content style editing.
clearCopyCharacteristics()
CharacteristicCopyPasteSessionRepo $session
static _determineTag(string $a_type)
copyCharacteristicFromSource(int $source_style_id, string $source_style_type, string $source_char, string $new_char, array $new_titles)
Copy characteristic.
getPresentationTitle(string $type, string $characteristic, bool $fallback_to_characteristic=true)
Get characteristic by key.
saveTitles(string $type, string $characteristic, array $titles)
Save titles for characteristic.