19declare(strict_types=1);
55 public function read(): void
66 usort($this->icons, [$this,
'compareIconsByName']);
71 if (
$a->getType() ==
$b->getType()) {
72 return strcmp(
$a->getName(),
$b->getName());
73 } elseif (
$a->getType() ==
'svg') {
75 } elseif (
$b->getType() ==
'svg') {
78 return strcmp(
$a->getType(),
$b->getType());
85 return strcmp(
$a->getPath(),
$b->getPath());
96 $dir_iterator =
new RecursiveDirectoryIterator($src);
97 }
catch (UnexpectedValueException
$e) {
101 $rec_it =
new RecursiveIteratorIterator($dir_iterator);
103 foreach ($rec_it as $file) {
104 if (!$file->isReadable()) {
107 if ($file->isFile()) {
108 $extension = $file->getExtension();
109 if ($extension ==
'gif' || $extension ==
'svg' || $extension ==
'png') {
121 foreach ($this->
getIcons() as $icon) {
122 $icon->changeColors($color_changes);
131 $this->icons[] = $icon;
148 foreach ($this->icons as $icon) {
149 if ($icon->getName() ==
$name) {
161 foreach ($this->icons as $icon) {
162 if ($icon->getPath() ==
$path) {
177 foreach ($this->
getIcons() as $icon) {
178 $folders[dirname($icon->getPath())][] = $icon;
183 foreach ($folders as
$id => $folder) {
184 ksort($folders[
$id]);
210 if (!isset($this->color_set)) {
222 foreach ($this->
getIcons() as $icon) {
223 $this->color_set->mergeColorSet($icon->getColorSet());
234 foreach ($this->
getIcons() as $icon) {
235 if ($icon->usesColor($color_id)) {
249 $usage_string .= rtrim($icon->getName(),
'.svg') .
'; ';
251 return $usage_string;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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.
getIconByName(string $name)
setColorSet(ilSystemStyleIconColorSet $color_set)
ilSystemStyleIconColorSet $color_set
Complete color set of all icons contained in this folder.
getUsagesOfColor(string $color_id)
Gets the usages of a certain color.
changeIconColors(array $color_changes)
Changes a set of colors in all icons contained in the folder.
addIcon(ilSystemStyleIcon $icon)
Adds an icon to the folders abstraction.
string $path
Path to the root of the folder.
extractColorSet()
Gets the color sets of all icons an merges them into one.
getUsagesOfColorAsString(string $color_id)
Gets the usages of a color as string.
readIconsFromFolder(string $src='')
getIconsSortedByFolder()
Sorts all icons by their occurrence in folders.
compareIconsByName(ilSystemStyleIcon $a, ilSystemStyleIcon $b)
getIcons()
Gets an Icon from the folders abstraction.
getIconByPath(string $path)
__construct(string $path)
ilSystemStyleIconFolder constructor.
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