mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
Fixed tabbed admin interface
This commit is contained in:
@@ -71,159 +71,3 @@ if (!function_exists('multiarray_sort')) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Experiment
|
||||
* Most basic & performance wise solution for admin icons override
|
||||
*/
|
||||
class e_admin_icons
|
||||
{
|
||||
/**
|
||||
* @var string icons absolute URL path
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* @var string icons relative server path
|
||||
*/
|
||||
protected $relpath;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
//XXX maybe we should use admintheme pref instead THEME here?
|
||||
if(is_readable(THEME.'icons/admin/'))
|
||||
{
|
||||
$this->path = THEME_ABS.'icons/admin/';
|
||||
$this->relpath = THEME.'icons/admin/';
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->path = e_IMAGE_ABS.'admin_images/';
|
||||
$this->relpath = e_IMAGE.'admin_images/';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon absolute path (url, without domain)
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon url without domain
|
||||
*/
|
||||
public function url($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
if($size)
|
||||
{
|
||||
$name .= '_'.$size;
|
||||
}
|
||||
return $this->path.$name.'.'.$extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image tag of an icon
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer $size default 16
|
||||
* @param string $class default empty
|
||||
* @param string $alt default empty
|
||||
* @param string $extension default 'png'
|
||||
* @return string img tag
|
||||
*/
|
||||
public function tag($name, $size = 16, $class='', $alt = '', $extension = 'png')
|
||||
{
|
||||
$_class = 'icon';
|
||||
if($size)
|
||||
{
|
||||
$_class .= ' S'.$size;
|
||||
}
|
||||
if($class)
|
||||
{
|
||||
$_class .= ' '.$class;
|
||||
}
|
||||
$src = $this->url($name, $size, $extension);
|
||||
|
||||
return '<img src="'.$src.'" alt="'.$alt.'" class="'.$_class.'" />';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon relative server path
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon relative server path
|
||||
*/
|
||||
public function path($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
if($size)
|
||||
{
|
||||
$name .= '_'.$size;
|
||||
}
|
||||
return $this->relpath.$name.'.'.$extension;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::url()
|
||||
* Get icon absolute path (url, without domain)
|
||||
* Example:
|
||||
* <code>
|
||||
* echo _I('edit');
|
||||
* // If icon path is overloaded by current admin theme:
|
||||
* // '/e107_themes/current_theme/icons/admin/edit_16.png'
|
||||
* // else
|
||||
* // '/e107_images/admin_images/edit_16.png'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon url without domain
|
||||
*/
|
||||
function _I($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
return e107::getSingleton('e_admin_icons')->url($name, $size, $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::tag()
|
||||
* Get image tag of an icon
|
||||
* Example: <code>echo _ITAG('edit');</code>
|
||||
* @see _I()
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer $size default 16
|
||||
* @param string $class default empty
|
||||
* @param string $alt default empty
|
||||
* @param string $extension default 'png'
|
||||
* @return string img tag
|
||||
*/
|
||||
function _ITAG($name, $size = 16, $class = '', $alt = '', $extension = 'png')
|
||||
{
|
||||
return e107::getSingleton('e_admin_icons')->tag($name, $size, $class, $alt, $extension);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenient proxy to e_admin_icons::path()
|
||||
* Get icon relative server path
|
||||
* <code>
|
||||
* echo _IPATH('edit');
|
||||
* // If icon path is overloaded by current admin theme:
|
||||
* // '../e107_themes/current_theme/icons/admin/edit_16.png'
|
||||
* // else
|
||||
* // '../e107_images/admin_images/edit_16.png'
|
||||
* </code>
|
||||
*
|
||||
* @param string $name without size and extension e.g. 'edit'
|
||||
* @param integer size pixel , default 16
|
||||
* @param string $extension without leading dot, default 'png'
|
||||
* @return string icon relative server path
|
||||
*/
|
||||
function _IPATH($name, $size = 16, $extension = 'png')
|
||||
{
|
||||
return e107::getSingleton('e_admin_icons')->path($name, $size, $extension);
|
||||
}
|
||||
|
Reference in New Issue
Block a user