2require_once(
"./Services/Style/System/classes/Icons/class.ilSystemStyleIcon.php");
3require_once(
"./Services/Style/System/classes/Exceptions/class.ilSystemStyleIconException.php");
65 if (
$a->getType() ==
$b->getType()) {
66 return strcmp($a->getName(), $b->getName());
68 if ($a->getType() ==
"svg") {
70 } elseif (
$b->getType() ==
"svg") {
73 return strcmp($a->getType(), $b->getType());
82 return strcmp(
$a->getPath(),
$b->getPath());
92 protected function xRead($src =
"", $rel_path =
"")
97 foreach (scandir($src) as $file) {
98 $src_file = rtrim($src,
'/') .
'/' . $file;
99 if (!is_readable($src_file)) {
102 if (substr($file, 0, 1) !=
".") {
103 if (is_dir($src_file)) {
104 self::xRead($src_file, $rel_path .
"/" . $file);
106 $info =
new SplFileInfo($src_file);
107 $extension = $info->getExtension();
108 if ($extension ==
"gif" || $extension ==
"svg" || $extension ==
"png") {
109 $this->addIcon(
new ilSystemStyleIcon($file, $this->getPath() . $rel_path .
"/" . $file, $extension));
124 foreach ($this->getIcons() as $icon) {
125 $icon->changeColors($color_changes);
136 $this->icons[] = $icon;
156 foreach ($this->icons as $icon) {
157 if ($icon->getName() ==
$name) {
171 foreach ($this->icons as $icon) {
172 if ($icon->getPath() == $path) {
188 foreach ($this->getIcons() as $icon) {
189 $folders[dirname($icon->getPath())][] = $icon;
194 foreach ($folders as $id => $folder) {
195 ksort($folders[$id]);
205 $this->icons = $icons;
229 if (!$this->color_set) {
230 $this->extractColorSet();
232 return $this->color_set;
241 foreach ($this->getIcons() as $icon) {
242 $this->color_set->mergeColorSet($icon->getColorSet());
255 foreach ($this->getIcons() as $icon) {
256 if ($icon->usesColor($color_id)) {
272 foreach ($this->getUsagesOfColor($color_id) as $icon) {
273 $usage_string .= rtrim($icon->getName(),
".svg") .
"; ";
275 return $usage_string;
283 $this->color_set = $color_set;
An exception for terminatinating execution or to throw for unit testing.
Class for advanced editing exception handling in ILIAS.
const FILE_OPENING_FAILED
Class for advanced editing exception handling in ILIAS.
const IMAGES_FOLDER_DOES_NOT_EXIST
const ICON_DOES_NOT_EXIST
Abstracts a folder containing a set of icons.
sortIcons()
Sorts the Icons by name and type.
changeIconColors(array $color_changes)
Changes a set of colors in all icons contained in the folder.
xRead($src="", $rel_path="")
addIcon(ilSystemStyleIcon $icon)
Adds an icon to the folders abstraction.
getUsagesOfColor($color_id)
Gets the usages of a certain color.
getUsagesOfColorAsString($color_id)
Gets the usages of a color as string.
__construct($path)
ilSystemStyleIconFolder constructor.
extractColorSet()
Gets the color sets of all icons an merges them into one.
getIconsSortedByFolder()
Sorts all icons by their occurrence in folders.
getIcons()
Gets an Icon from the folders abstraction.
read()
Reads the folder recursively and sorts the icons by name and type.
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon.
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples