mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-04 17:44:38 +09:00
Support PNG and SVG icon sets for document icons
This commit is contained in:
parent
f2ff393592
commit
21e99aa7a2
2 changed files with 41 additions and 7 deletions
|
|
@ -56,6 +56,34 @@ class documentAdminController extends document
|
||||||
$config->view_count_option = Context::get('view_count_option');
|
$config->view_count_option = Context::get('view_count_option');
|
||||||
$config->icons = Context::get('icons');
|
$config->icons = Context::get('icons');
|
||||||
$config->micons = Context::get('micons');
|
$config->micons = Context::get('micons');
|
||||||
|
|
||||||
|
// Get icon skin type
|
||||||
|
$config->icons_type = 'gif';
|
||||||
|
$config->micons_type = 'gif';
|
||||||
|
$icons_path = rtrim($this->module_path . 'tpl/icons/' . $config->icons, '/');
|
||||||
|
if (!file_exists($icons_path . '/new.gif'))
|
||||||
|
{
|
||||||
|
if (file_exists($icons_path . '/new.png'))
|
||||||
|
{
|
||||||
|
$config->icons_type = 'png';
|
||||||
|
}
|
||||||
|
elseif (file_exists($icons_path . '/new.svg'))
|
||||||
|
{
|
||||||
|
$config->icons_type = 'svg';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$micons_path = rtrim($this->module_path . 'tpl/icons/' . $config->micons, '/');
|
||||||
|
if (!file_exists($micons_path . '/new.gif'))
|
||||||
|
{
|
||||||
|
if (file_exists($micons_path . '/new.png'))
|
||||||
|
{
|
||||||
|
$config->micons_type = 'png';
|
||||||
|
}
|
||||||
|
elseif (file_exists($micons_path . '/new.svg'))
|
||||||
|
{
|
||||||
|
$config->micons_type = 'svg';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert by creating the module Controller object
|
// Insert by creating the module Controller object
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
|
|
|
||||||
|
|
@ -1350,29 +1350,35 @@ class documentItem extends BaseObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$icons = $this->getExtraImages($time_check);
|
||||||
|
if(!count($icons))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$documentConfig = DocumentModel::getDocumentConfig();
|
$documentConfig = DocumentModel::getDocumentConfig();
|
||||||
|
|
||||||
if(Mobile::isFromMobilePhone())
|
if(Mobile::isFromMobilePhone())
|
||||||
{
|
{
|
||||||
$iconSkin = $documentConfig->micons ?? null;
|
$iconSkin = $documentConfig->micons ?? null;
|
||||||
|
$iconType = $documentConfig->micons_type ?? 'gif';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$iconSkin = $documentConfig->icons ?? null;
|
$iconSkin = $documentConfig->icons ?? null;
|
||||||
|
$iconType = $documentConfig->icons_type ?? 'gif';
|
||||||
}
|
}
|
||||||
if($iconSkin == null)
|
if($iconSkin == null)
|
||||||
{
|
{
|
||||||
$iconSkin = 'default';
|
$iconSkin = 'default';
|
||||||
|
$iconType = 'gif';
|
||||||
}
|
}
|
||||||
$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
|
|
||||||
|
$path = sprintf('%s%s', \RX_BASEURL, "modules/document/tpl/icons/$iconSkin/");
|
||||||
$buffs = $this->getExtraImages($time_check);
|
|
||||||
if(!count($buffs)) return;
|
|
||||||
|
|
||||||
$buff = array();
|
$buff = array();
|
||||||
foreach($buffs as $key => $val)
|
foreach($icons as $icon)
|
||||||
{
|
{
|
||||||
$buff[] = sprintf('<img src="%s%s.gif" alt="%s" title="%s" style="margin-right:2px;" />', $path, $val, $val, $val);
|
$buff[] = sprintf('<img src="%s%s.%s" alt="%s" title="%s" style="margin-right:2px;" />', $path, $icon, $iconType, $icon, $icon);
|
||||||
}
|
}
|
||||||
return implode('', $buff);
|
return implode('', $buff);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue