2023-12-03 22:10:18 +04:00
|
|
|
<?php
|
|
|
|
namespace nur\v;
|
|
|
|
|
|
|
|
use nur\v\html5\Html5IconManager;
|
|
|
|
use nur\v\model\IIconManager;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class icon: gestion des icones
|
|
|
|
*/
|
|
|
|
class icon {
|
|
|
|
const MANAGER_CLASS = Html5IconManager::class;
|
|
|
|
|
|
|
|
protected static $manager_class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* spécifier la classe à utiliser pour instancier le gestionnaire de
|
|
|
|
* iconulaires
|
|
|
|
*
|
|
|
|
* cette méthode *doit* être appelée avant d'appeler la méthode
|
|
|
|
* {@link manager()}
|
|
|
|
*/
|
|
|
|
static final function set_manager_class(string $manager_class) {
|
|
|
|
self::$manager_class = $manager_class;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @var IIconManager */
|
|
|
|
protected static $manager;
|
|
|
|
|
|
|
|
static final function set_manager(IIconManager $manager) {
|
|
|
|
self::$manager = $manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** obtenir l'instance globale de gestionnaire de iconulaire */
|
|
|
|
static final function manager(): IIconManager {
|
|
|
|
if (self::$manager === null) {
|
|
|
|
$manager_class = self::$manager_class;
|
|
|
|
if ($manager_class === null) $manager_class = static::MANAGER_CLASS;
|
|
|
|
self::$manager = new $manager_class();
|
|
|
|
}
|
|
|
|
return self::$manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
static final function __callStatic($name, $args) {
|
|
|
|
$name = str_replace("_", "-", $name);
|
|
|
|
return self::manager()->getIcon($name, ...$args);
|
|
|
|
}
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
|
|
|
|
static final function info(?string $suffix=null, ?string $alt="INFO: "): array { return self::manager()->getIcon("info", $suffix, $alt); }
|
|
|
|
static final function success(?string $suffix=null, ?string $alt="SUCCESS: "): array { return self::manager()->getIcon("success", $suffix, $alt); }
|
|
|
|
static final function warning(?string $suffix=null, ?string $alt="WARNING: "): array { return self::manager()->getIcon("warning", $suffix, $alt); }
|
|
|
|
static final function error(?string $suffix=null, ?string $alt="ERROR: "): array { return self::manager()->getIcon("error", $suffix, $alt); }
|
|
|
|
|
|
|
|
static final function refresh(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("refresh", $suffix, $alt); }
|
|
|
|
static final function config(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("config", $suffix, $alt); }
|
|
|
|
static final function save(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("save", $suffix, $alt); }
|
|
|
|
static final function download(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("download", $suffix, $alt); }
|
|
|
|
static final function mail(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("mail", $suffix, $alt); }
|
|
|
|
static final function search(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("search", $suffix, $alt); }
|
|
|
|
static final function user(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("user", $suffix, $alt); }
|
|
|
|
static final function login(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("login", $suffix, $alt); }
|
|
|
|
static final function logout(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("logout", $suffix, $alt); }
|
2024-05-01 10:00:45 +04:00
|
|
|
static final function new_window(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("new_window", $suffix, $alt); }
|
2023-12-03 22:10:18 +04:00
|
|
|
|
|
|
|
static final function arrow_up(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("arrow_up", $suffix, $alt); }
|
|
|
|
static final function arrow_down(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("arrow_down", $suffix, $alt); }
|
|
|
|
static final function arrow_left(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("arrow_left", $suffix, $alt); }
|
|
|
|
static final function arrow_right(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("arrow_right", $suffix, $alt); }
|
|
|
|
static final function chevron_up(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("chevron_up", $suffix, $alt); }
|
|
|
|
static final function chevron_down(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("chevron_down", $suffix, $alt); }
|
|
|
|
static final function chevron_left(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("chevron_left", $suffix, $alt); }
|
|
|
|
static final function chevron_right(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("chevron_right", $suffix, $alt); }
|
|
|
|
static final function hand_up(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("hand_up", $suffix, $alt); }
|
|
|
|
static final function hand_down(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("hand_down", $suffix, $alt); }
|
|
|
|
static final function hand_left(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("hand_left", $suffix, $alt); }
|
|
|
|
static final function hand_right(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("hand_right", $suffix, $alt); }
|
|
|
|
static final function menu_up(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("menu_up", $suffix, $alt); }
|
|
|
|
static final function menu_down(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("menu_down", $suffix, $alt); }
|
|
|
|
static final function menu_left(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("menu_left", $suffix, $alt); }
|
|
|
|
static final function menu_right(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("menu_right", $suffix, $alt); }
|
|
|
|
static final function triangle_up(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("triangle_up", $suffix, $alt); }
|
|
|
|
static final function triangle_down(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("triangle_down", $suffix, $alt); }
|
|
|
|
static final function triangle_left(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("triangle_left", $suffix, $alt); }
|
|
|
|
static final function triangle_right(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("triangle_right", $suffix, $alt); }
|
|
|
|
|
|
|
|
static final function star(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("star", $suffix, $alt); }
|
|
|
|
static final function star_empty(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("star_empty", $suffix, $alt); }
|
|
|
|
static final function heart(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("heart", $suffix, $alt); }
|
|
|
|
static final function heart_empty(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("heart_empty", $suffix, $alt); }
|
|
|
|
|
|
|
|
# template:
|
|
|
|
#static final function xxx(?string $suffix=null, ?string $alt=null): array { return self::manager()->getIcon("xxx", $suffix, $alt); }
|
|
|
|
}
|