public function render() { $name = $this->getName(); $img = KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', '/32/' . $name . '.png'); if ($img) { KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.css', '.toolbar .icon-32-' . $name . ' { background-image: url(' . $img . '); }'); } $text = JText::_($this->_options['text']); $view = KRequest::get('get.view', 'cmd'); $link = ' href="' . JRoute::_($this->getLink()) . '"'; $html = array(); // Sanitize the url since we can't trust the server var $url = KFactory::get('lib.koowa.filter.url')->sanitize($this->getLink()); // Create the URI object $uri = KFactory::tmp('lib.koowa.http.uri', array('uri' => $url)); $query = $uri->getQuery(1); $html[] = '<td class="button" id="' . $this->getId() . '">'; $active = $view == KInflector::variablize(KInflector::pluralize($query['view'])) || $view == KInflector::variablize(KInflector::singularize($query['view'])); $hide = !KInflector::isPlural($view); if ($active || $hide || !$this->modal) { $html[] = '<a class="toolbar inactive">'; } else { $html[] = '<a' . $link . ' onclick="' . $this->getOnClick() . '" class="toolbar">'; } $html[] = '<span class="' . $this->getClass() . '" title="' . $text . '">'; $html[] = '</span>'; $html[] = $text; if (!$active && !$hide || $this->modal) { $html[] = '</a>'; } else { $html[] = '</a>'; } $html[] = '</td>'; return implode(PHP_EOL, $html); }
public function render() { $name = $this->getName(); $img = KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', '/32/' . $name . '.png'); if ($img) { KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.css', '.toolbar .icon-32-' . $name . ' { background-image: url(' . $img . '); }'); } $text = JText::_($this->_options['text']); $options[] = JHTML::_('select.option', null, $text); $options[] = JHTML::_('select.option', 'kunena', JText::_('Kunena')); $options[] = JHTML::_('select.option', 'sample', JText::_('Sample Content')); // TEST: Uncomment this line to test the fireboard import option //$options[] = JHTML::_('select.option', 'fireboard', JText::_('FireBoard') ); //$options[] = JHTML::_('select.option', 'test', JText::_('Test Unsupported') ); $select = KTemplateAbstract::loadHelper('select.genericlist', $options, 'import', array('class' => 'inputbox', 'onchange' => $this->getOnChange(), 'style' => 'cursor:pointer;width:70px;')); $html[] = '<td class="button" id="' . $this->getId() . '">'; $html[] = '<a class="toolbar hasTip" title="' . JText::_('Select what you want to import') . '" style="cursor:default;" >'; $html[] = '<span class="' . $this->getClass() . '" title="' . $text . '">'; $html[] = '</span>'; $html[] = $select; $html[] = '</a>'; $html[] = '</td>'; return implode(PHP_EOL, $html); }
/** * function description * * @author Stian Didriksen <*****@*****.**> * @return returns an image nested in an anchor element. */ public function required($enable, $id, $imgY = 'enable.png', $imgX = 'disable.png') { //Load koowa javascript KTemplateAbstract::loadHelper('script', KRequest::root() . '/media/plg_koowa/js/koowa.js'); $img = $enable ? $imgY : $imgX; $alt = $enable ? JText::_('Required') : JText::_('Optional'); $text = $enable ? JText::_('Make item optional') : JText::_('Require Item'); $action = $enable ? 'optional' : 'required'; $href = ' <a href="#" onclick="Koowa.Form.addField(\'' . $action . '\', \'cb' . $id . '\');Koowa.Form.addField(\'action\', \'' . $action . '\');Koowa.Form.submit(\'post\')" title="' . $text . '"> <img src="' . JURI::root() . 'media/com_ninja/images/16/' . $img . '" border="0" alt="' . $alt . '" /> </a>'; return $href; }
public function img($src) { return KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', $src); }
public function imagesgeneric($path, $name, $attribs = null, $selected = NULL, $idtag = false, $translate = false) { $images = KFactory::get('admin::com.ninja.model.images')->folder($path); $options = $images->getList(); $img = $images->getImages(); if (!$idtag) { $idtag = $name; } //die('<pre>'.var_export($img, true).'</pre>'); $document = Kfactory::get('lib.joomla.document'); $document->addScriptDeclaration('var ' . $idtag . 'Images = new Asset.images(' . json_encode((array) $img) . ', { onComplete: function(){ $(\'rank_image_preview\').empty(); ' . $idtag . 'Images[$(\'' . $idtag . '\').selectedIndex].clone().injectInside(\'rank_image_preview\'); } });'); $attr = array('onchange' => '$(\'rank_image_preview\').empty(); ' . $idtag . 'Images[this.selectedIndex].clone().injectInside(\'rank_image_preview\')', 'class' => 'value', 'style' => 'display: block;'); $document->addStyleDeclaration('.group.images {text-align: center; padding-right: 1px !important; padding-bottom: 1px !important;} .group.images select { width:100%; min-width: 60px; margin-top: 2px!important ; }'); ob_start(); ?> <div class="group images"> <div id="rank_image_preview"><img src="<?php echo KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.image', '/16/spinner.gif'); ?> " /></div> <?php echo JHTML::_('genericlist', $options, $name, $attr, 'value', 'text', $selected); ?> </div> <?php return ob_get_clean(); }