2023-12-03 22:10:18 +04:00
|
|
|
<?php
|
|
|
|
namespace nur\v\bs3;
|
|
|
|
|
|
|
|
use nur\v\model\IIconManager;
|
|
|
|
|
|
|
|
class Bs3IconManager implements IIconManager {
|
|
|
|
const GLYPHS = [
|
|
|
|
"debug" => "bullhorn",
|
|
|
|
"info" => "info-sign",
|
|
|
|
"success" => "ok-sign",
|
|
|
|
"warning" => "exclamation-sign",
|
|
|
|
"error" => "remove-sign",
|
|
|
|
|
|
|
|
"refresh",
|
|
|
|
"config" => "cog",
|
|
|
|
"save" => "floppy-disk",
|
|
|
|
"download" => "download-alt",
|
2024-06-14 19:57:50 +04:00
|
|
|
"upload" => "cloud-upload",
|
2023-12-03 22:10:18 +04:00
|
|
|
"new_window",
|
2024-07-17 10:29:46 +04:00
|
|
|
"mail" => "envelope",
|
2023-12-03 22:10:18 +04:00
|
|
|
"search",
|
|
|
|
"user",
|
|
|
|
"login" => "log-in",
|
|
|
|
"logout" => "log-out",
|
|
|
|
"bin" => "trash",
|
2024-07-17 10:29:46 +04:00
|
|
|
"dashboard" => "list-alt",
|
|
|
|
"calendar",
|
2023-12-03 22:10:18 +04:00
|
|
|
|
|
|
|
"arrow_up", "arrow_down", "arrow_left", "arrow_right",
|
|
|
|
"chevron_up", "chevron_down", "chevron_left", "chevron_right",
|
|
|
|
"hand_up", "hand_down", "hand_left", "hand_right",
|
|
|
|
"menu_up", "menu_down", "menu_left", "menu_right",
|
|
|
|
"triangle_up", "triangle_down", "triangle_left", "triangle_right",
|
|
|
|
|
|
|
|
"star", "star_empty",
|
|
|
|
"heart", "heart_empty",
|
|
|
|
];
|
|
|
|
|
|
|
|
private function _getIcon(string $glyph, $suffix=null, ?string $alt=null, ?array $glyphMap=null): array {
|
|
|
|
if ($glyphMap === null) $glyphMap = self::_GLYPH_MAP;
|
|
|
|
if (isset($glyphMap[$glyph])) $glyph = $glyphMap[$glyph];
|
|
|
|
|
|
|
|
if ($alt) {
|
|
|
|
$alt = <<<EOT
|
|
|
|
<span class="sr-only">$alt</span>
|
|
|
|
EOT;
|
|
|
|
}
|
|
|
|
$html = <<<EOT
|
|
|
|
<span class="glyphicon glyphicon-$glyph" aria-hidden="true"></span>$alt
|
|
|
|
EOT;
|
|
|
|
|
|
|
|
$icon = [$html];
|
|
|
|
if ($suffix) {
|
|
|
|
$icon[] = " ";
|
|
|
|
$icon[] = q($suffix);
|
|
|
|
}
|
|
|
|
return $icon;
|
|
|
|
}
|
|
|
|
function getIcon(string $glyph, $suffix=null, ?string $alt=null, ?array $glyphMap=null): array {
|
|
|
|
return $this->_getIcon($glyph, $suffix, $alt);
|
|
|
|
}
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
const _AUTOGEN_CONSTS = ["_GLYPH_MAP", "" => ["_AUTOGEN__GLYPHS"]];
|
|
|
|
static final function _AUTOGEN__GLYPH_MAP(): array {
|
|
|
|
$glyphs = [];
|
|
|
|
$index = 0;
|
|
|
|
foreach (self::GLYPHS as $key => $glyph) {
|
|
|
|
if ($key === $index) {
|
|
|
|
$name = $glyph;
|
|
|
|
$glyph = strtolower(str_replace("_", "-", $glyph));
|
|
|
|
$index++;
|
|
|
|
} else {
|
|
|
|
$name = $key;
|
|
|
|
}
|
|
|
|
$glyphs[$name] = $glyph;
|
|
|
|
}
|
|
|
|
return $glyphs;
|
|
|
|
}
|
|
|
|
const _GLYPH_MAP = /*autogen*/[
|
|
|
|
'debug' => 'bullhorn',
|
|
|
|
'info' => 'info-sign',
|
|
|
|
'success' => 'ok-sign',
|
|
|
|
'warning' => 'exclamation-sign',
|
|
|
|
'error' => 'remove-sign',
|
|
|
|
'refresh' => 'refresh',
|
|
|
|
'config' => 'cog',
|
|
|
|
'save' => 'floppy-disk',
|
|
|
|
'download' => 'download-alt',
|
2024-06-14 19:57:50 +04:00
|
|
|
'upload' => 'cloud-upload',
|
2023-12-03 22:10:18 +04:00
|
|
|
'new_window' => 'new-window',
|
2024-07-17 10:29:46 +04:00
|
|
|
'mail' => 'envelope',
|
2023-12-03 22:10:18 +04:00
|
|
|
'search' => 'search',
|
|
|
|
'user' => 'user',
|
|
|
|
'login' => 'log-in',
|
|
|
|
'logout' => 'log-out',
|
|
|
|
'bin' => 'trash',
|
2024-07-17 10:29:46 +04:00
|
|
|
'dashboard' => 'list-alt',
|
2023-12-03 22:10:18 +04:00
|
|
|
'arrow_up' => 'arrow-up',
|
|
|
|
'arrow_down' => 'arrow-down',
|
|
|
|
'arrow_left' => 'arrow-left',
|
|
|
|
'arrow_right' => 'arrow-right',
|
|
|
|
'chevron_up' => 'chevron-up',
|
|
|
|
'chevron_down' => 'chevron-down',
|
|
|
|
'chevron_left' => 'chevron-left',
|
|
|
|
'chevron_right' => 'chevron-right',
|
|
|
|
'hand_up' => 'hand-up',
|
|
|
|
'hand_down' => 'hand-down',
|
|
|
|
'hand_left' => 'hand-left',
|
|
|
|
'hand_right' => 'hand-right',
|
|
|
|
'menu_up' => 'menu-up',
|
|
|
|
'menu_down' => 'menu-down',
|
|
|
|
'menu_left' => 'menu-left',
|
|
|
|
'menu_right' => 'menu-right',
|
|
|
|
'triangle_up' => 'triangle-up',
|
|
|
|
'triangle_down' => 'triangle-down',
|
|
|
|
'triangle_left' => 'triangle-left',
|
|
|
|
'triangle_right' => 'triangle-right',
|
|
|
|
'star' => 'star',
|
|
|
|
'star_empty' => 'star-empty',
|
|
|
|
'heart' => 'heart',
|
|
|
|
'heart_empty' => 'heart-empty',
|
|
|
|
];
|
|
|
|
static final function _AUTOGEN__GLYPHS(): array {
|
|
|
|
$glyphMap = self::_AUTOGEN__GLYPH_MAP();
|
|
|
|
$im = new self();
|
|
|
|
$glyphs = [];
|
|
|
|
foreach (array_keys($glyphMap) as $glyph) {
|
|
|
|
$name = strtoupper($glyph);
|
|
|
|
$glyphs[$name] = $im->_getIcon($glyph, null, null, $glyphMap);
|
|
|
|
}
|
|
|
|
return $glyphs;
|
|
|
|
}
|
|
|
|
# --autogen-dynamic-consts--
|
|
|
|
const DEBUG = /*autogen*/['<span class="glyphicon glyphicon-bullhorn" aria-hidden="true"></span>'];
|
|
|
|
const INFO = /*autogen*/['<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>'];
|
|
|
|
const SUCCESS = /*autogen*/['<span class="glyphicon glyphicon-ok-sign" aria-hidden="true"></span>'];
|
|
|
|
const WARNING = /*autogen*/[
|
|
|
|
'<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>',
|
|
|
|
];
|
|
|
|
const ERROR = /*autogen*/['<span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span>'];
|
|
|
|
const REFRESH = /*autogen*/['<span class="glyphicon glyphicon-refresh" aria-hidden="true"></span>'];
|
|
|
|
const CONFIG = /*autogen*/['<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>'];
|
|
|
|
const SAVE = /*autogen*/['<span class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span>'];
|
|
|
|
const DOWNLOAD = /*autogen*/['<span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>'];
|
2024-06-14 19:57:50 +04:00
|
|
|
const UPLOAD = /*autogen*/['<span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span>'];
|
2023-12-03 22:10:18 +04:00
|
|
|
const NEW_WINDOW = /*autogen*/['<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>'];
|
2024-07-17 10:29:46 +04:00
|
|
|
const MAIL = /*autogen*/['<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span>'];
|
2023-12-03 22:10:18 +04:00
|
|
|
const SEARCH = /*autogen*/['<span class="glyphicon glyphicon-search" aria-hidden="true"></span>'];
|
|
|
|
const USER = /*autogen*/['<span class="glyphicon glyphicon-user" aria-hidden="true"></span>'];
|
|
|
|
const LOGIN = /*autogen*/['<span class="glyphicon glyphicon-log-in" aria-hidden="true"></span>'];
|
|
|
|
const LOGOUT = /*autogen*/['<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>'];
|
|
|
|
const BIN = /*autogen*/['<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>'];
|
2024-07-17 10:29:46 +04:00
|
|
|
const DASHBOARD = /*autogen*/['<span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span>'];
|
|
|
|
const CALENDAR = /*autogen*/['<span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>'];
|
2023-12-03 22:10:18 +04:00
|
|
|
const ARROW_UP = /*autogen*/['<span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span>'];
|
|
|
|
const ARROW_DOWN = /*autogen*/['<span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span>'];
|
|
|
|
const ARROW_LEFT = /*autogen*/['<span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span>'];
|
|
|
|
const ARROW_RIGHT = /*autogen*/['<span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span>'];
|
|
|
|
const CHEVRON_UP = /*autogen*/['<span class="glyphicon glyphicon-chevron-up" aria-hidden="true"></span>'];
|
|
|
|
const CHEVRON_DOWN = /*autogen*/['<span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span>'];
|
|
|
|
const CHEVRON_LEFT = /*autogen*/['<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>'];
|
|
|
|
const CHEVRON_RIGHT = /*autogen*/['<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>'];
|
|
|
|
const HAND_UP = /*autogen*/['<span class="glyphicon glyphicon-hand-up" aria-hidden="true"></span>'];
|
|
|
|
const HAND_DOWN = /*autogen*/['<span class="glyphicon glyphicon-hand-down" aria-hidden="true"></span>'];
|
|
|
|
const HAND_LEFT = /*autogen*/['<span class="glyphicon glyphicon-hand-left" aria-hidden="true"></span>'];
|
|
|
|
const HAND_RIGHT = /*autogen*/['<span class="glyphicon glyphicon-hand-right" aria-hidden="true"></span>'];
|
|
|
|
const MENU_UP = /*autogen*/['<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>'];
|
|
|
|
const MENU_DOWN = /*autogen*/['<span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>'];
|
|
|
|
const MENU_LEFT = /*autogen*/['<span class="glyphicon glyphicon-menu-left" aria-hidden="true"></span>'];
|
|
|
|
const MENU_RIGHT = /*autogen*/['<span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>'];
|
|
|
|
const TRIANGLE_UP = /*autogen*/['<span class="glyphicon glyphicon-triangle-up" aria-hidden="true"></span>'];
|
|
|
|
const TRIANGLE_DOWN = /*autogen*/['<span class="glyphicon glyphicon-triangle-down" aria-hidden="true"></span>'];
|
|
|
|
const TRIANGLE_LEFT = /*autogen*/['<span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>'];
|
|
|
|
const TRIANGLE_RIGHT = /*autogen*/['<span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>'];
|
|
|
|
const STAR = /*autogen*/['<span class="glyphicon glyphicon-star" aria-hidden="true"></span>'];
|
|
|
|
const STAR_EMPTY = /*autogen*/['<span class="glyphicon glyphicon-star-empty" aria-hidden="true"></span>'];
|
|
|
|
const HEART = /*autogen*/['<span class="glyphicon glyphicon-heart" aria-hidden="true"></span>'];
|
|
|
|
const HEART_EMPTY = /*autogen*/['<span class="glyphicon glyphicon-heart-empty" aria-hidden="true"></span>'];
|
|
|
|
}
|