setQuery($query);
$template = $db->loadResult();
$path = JURI::Root(true) . "/modules/mod_roktabs/";
$document->addStyleSheet($path . 'admin/icons.css');
$version = new JVersion();
if (version_compare($version->getShortVersion(), '3.0', '<')) {
$document->addScript($path . 'admin/icons_25.js');
} else {
$document->addScript($path . 'admin/icons.js');
}
$document->addScriptDeclaration("
var SitePath = '" . JURI::Root(true) . "', TemplatePath = 'templates/" . $template . "', ModulePath = 'modules/mod_roktabs';
window.addEvent('domready', function() {new RokTabsIcons();});
");
}
$html = "";
$value = str_replace(" ", "", $this->value);
$list = explode(",", $value);
$i = 0;
foreach ($list as $img) {
$i++;
$html .= "
";
$html .= "
Tab " . $i . ": ";
$html .= "
";
$html .= "
";
$html .= "
";
$html .= " ";
$html .= " ";
$html .= "
";
$html .= "
";
$html .= "
";
}
$html .= "";
return $html;
}
/**
* @param $name
* @param $value
* @param $template
*
* @return string
*/
function loadIcons($name, $value, $template)
{
$path = JPATH_SITE . "/modules/mod_roktabs/images/";
$urlPath = JURI::Root(true) . "/modules/mod_roktabs/images/";
if ($this->form->getValue('tabs_iconpath', 'params') != '') {
$path = JPATH_SITE . '/' . $this->form->getValue('tabs_iconpath', 'params');
$urlPath = JURI::Root(true) . "/" . $this->form->getValue('tabs_iconpath', 'params');
}
$path = str_replace('__template__', 'templates' . '/' . $template, $path);
$urlPath = str_replace('__template__', 'templates/' . $template, $urlPath);
$path = str_replace('__module__', 'modules/mod_roktabs', $path);
$urlPath = str_replace('__module__', 'modules/mod_roktabs', $urlPath);
$icons = array('__none__');
$html = "";
if ($handle = @opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$ext = strtolower(substr($file, strrpos($file, '.') + 1));
if ($ext == 'gif' || $ext == 'bmp' || $ext == 'jpg' || $ext == 'png') {
array_push($icons, $file);
}
}
}
closedir($handle);
}
foreach ($icons as $icon) {
if ($icon == $value) $selected = "selected='selected'"; else $selected = "";
$html .= "";
}
return $html;
}
}