public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $categories = new DJMediatoolsModelCategories(); $this->category_options = $categories->getSelectOptions(true, false, 0, true); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } foreach ($this->items as $item) { if (!($item->thumb = DJImageResizer::createThumbnail($item->image, 'media/djmediatools/cache', 60, 40, 'crop', 80))) { $item->thumb = $item->image; } if (strcasecmp(substr($item->image, 0, 4), 'http') != 0 && !empty($item->image)) { $item->image = JURI::root(true) . '/' . $item->image; } if (strcasecmp(substr($item->thumb, 0, 4), 'http') != 0 && !empty($item->thumb)) { $item->thumb = JURI::root(true) . '/' . $item->thumb; } } $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->ordering = $this->get('Ordering'); $categories = new DJMediatoolsModelCategories(); $this->category_options = $categories->getSelectOptions(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } foreach ($this->items as $item) { if (!($item->thumb = DJImageResizer::createThumbnail($item->image, 'media/djmediatools/cache', 60, 40, 'crop', 80))) { $item->thumb = 'administrator/components/com_djmediatools/assets/icon-48-category.png'; } if (strcasecmp(substr($item->image, 0, 4), 'http') != 0 && !empty($item->image)) { $item->image = JURI::root(true) . '/' . $item->image; } if (strcasecmp(substr($item->thumb, 0, 4), 'http') != 0 && !empty($item->thumb)) { $item->thumb = JURI::root(true) . '/' . $item->thumb; } } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } parent::display($tpl); }
protected function getInput() { $attr = ''; $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $disable_default = $this->element['disable_default'] == 'true' ? true : false; $disable_self = $this->element['disable_self'] == 'true' ? true : false; $only_component = $this->element['only_component'] == 'true' ? true : false; $categories = new DJMediatoolsModelCategories(); $options = $categories->getSelectOptions($disable_default, $disable_self, 0, $only_component); $html = JHTML::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value); return $html; }