/** * Display the view */ public function display($tpl = null) { // get the data $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->params = JComponentHelper::getParams('com_jkit'); // lists $this->lists = new stdClass(); $this->lists->langs = JKitHelperLangs::getLangs(); $this->lists->translations = array(); // get tag translations if (isset($this->item->id)) { $translations = JKitHelperLangs::getTranslations(array($this->item), 'tags'); if (count($translations)) { foreach ($translations as $translation) { $this->lists->translations[$translation->lang] = new stdClass(); $this->lists->translations[$translation->lang]->title = $translation->title; $this->lists->translations[$translation->lang]->alias = $translation->alias; } } } // create the toolbar JKitHelper::getToolbar(false, $this->item->id, $this->item->title); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->item = $this->get('Item'); $this->translation = $this->get('Translation'); $this->language = JKitHelperLangs::getLangTitle(JRequest::getCmd('lang')); $this->params = JComponentHelper::getParams('com_jkit'); // create the toolbar JKitHelper::getToolbar(false, true, $this->item->title . ' (' . JText::sprintf('COM_JKIT_TRANSLATION_TITLE', $this->language) . ')'); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // get params $this->params = JComponentHelper::getParams('com_jkit'); // create the toolbar JKitHelper::getToolbar(false, $this->item->id, $this->item->title); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // filters $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // create the toolbar JKitHelper::getToolbar('users', $this->state->get('filter.state') == -2); $this->sidebar = JHtmlSidebar::render(); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // get the image $imageHelper = new JKitHelperImage(JComponentHelper::getParams('com_jkit')); $this->image = $imageHelper->getImage($this->item->id, 'users'); // get params $this->params = JComponentHelper::getParams('com_jkit'); // create the toolbar JKitHelper::getToolbar(); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get data $this->categories = $this->get('Categories'); $this->langs = $this->get('Langs'); $this->edited = $this->get('Edited'); $this->added = $this->get('Added'); $this->images = $this->get('Images'); $this->translations = $this->get('Translations'); // create the toolbar JKitHelper::getToolbar('panel'); // sidebar $this->sidebar = JHtmlSidebar::render(); // display the view layout parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); // filters $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // lists $this->lists = new stdClass(); $this->lists->langs = JKitHelperLangs::getLangs(); $this->lists->translations = JKitHelperLangs::getTranslations($this->items, 'tags'); // toolbar and sidbar JKitHelper::getToolbar(false, $this->state->get('filter.state') == -2); $this->sidebar = JHtmlSidebar::render(); // display the view template parent::display($tpl); }
/** * Display the view */ public function display($tpl = null) { // get the data from the model $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // get the tags $this->tags = $this->get('Tags'); $this->tag_list = $this->get('TagList'); $this->item_tags = $this->get('ItemTags'); $this->item_tag_list = $this->get('ItemTagList'); // get the types $this->types = $this->get('Types'); $this->item_type = $this->get('ItemType'); // get params $this->params = JComponentHelper::getParams('com_jkit'); // get the image $imageHelper = new JKitHelperImage(JComponentHelper::getParams('com_jkit')); $this->image = $imageHelper->getImage($this->item->id, 'items'); // create the toolbar JKitHelper::getToolbar(false, $this->item->id, $this->item->title); // display the view template parent::display($tpl); }
<!-- main --> <div class="row-fluid" id="jkit-view-item"> <div class="span9"> <!-- info --> <div class="form-horizontal"> <fieldset> <?php echo $this->form->getControlGroup('title'); ?> <?php foreach (array('intro', 'body', 'link', 'video', 'attachment', 'event', 'pricing', 'quote', 'contact', 'image', 'tags', 'data') as $field) { echo JKitHelper::getControlGroup($params, $field); } ?> </fieldset> </div> </div> <!-- sidebar --> <div class="span3"> <!-- publishing --> <div class="well"> <?php echo $this->form->getControlGroup('id'); ?>
<?php /** * @package JKit * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; // load assets JKitHelper::loadAssets(); $path_images = JURI::root() . 'images/jkit/images/'; $slider_id = 'jkit-item-slider-' . $item->id; ?> <?php if ($item->images) { ?> <div class="jkit-item-slider"> <div id="<?php echo $slider_id; ?> " class="carousel slide"> <ol class="carousel-indicators"> <?php foreach ($item->images as $i => $image) { ?> <li data-target="#<?php echo $slider_id; ?> " data-slide-to="<?php
?> </td> <td class="nowrap center hidden-phone"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td class="nowrap center"> <div class="btn-group"> <?php echo JHtml::_('jgrid.published', $item->state, $i, $context . '.', $canChange, 'cb'); ?> <?php echo JKitHelper::renderFeatured($item->featured, $i); ?> <?php // Create dropdown items $action = $archived ? 'unarchive' : 'archive'; JHtml::_('actionsdropdown.' . $action, 'cb' . $i, $context); $action = $trashed ? 'untrash' : 'trash'; JHtml::_('actionsdropdown.' . $action, 'cb' . $i, $context); // Render dropdown list echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); ?> </div> </td> <td class="nowrap center small"> <?php
?> </fieldset> </div> <!-- data --> <div class="form-horizontal <?php echo isset($type_params->data) && $type_params->data ? '' : 'hide'; ?> " id="jkit-fieldset-data"> <fieldset> <legend><?php echo JText::_('COM_JKIT_ITEM_FIELDSET_DATA'); ?> </legend> <?php echo JKitHelper::getControlGroup($params, 'data'); ?> </fieldset> </div> </div> <!-- sidebar --> <div class="span3"> <!-- image --> <div class="well <?php echo $type_params->image ? '' : 'hide'; ?> " id="jkit-fieldset-image"> <h3><?php
/** * Get the item * * @param int $item_id id of the item to be loaded * @param bool $prepare_content apply content plugins to item body and intro * * @return object */ public function getItem($item_id = null, $prepare_content = true) { if (isset($this->item)) { return $this->item; } // helpers $db = $this->_db; $imageHelper = new JKitHelperImage(JComponentHelper::getParams('com_jkit')); // determine item id $id = $item_id ? $item_id : JRequest::getInt('id'); // get the item $query_item = $db->getQuery(true)->select('a.*')->from('#__jkit_items AS a')->where("a.id = {$id}")->where('a.state = 1'); $query_item->select('c.title AS category')->leftJoin('#__categories AS c ON c.id = a.catid'); $query_item->select('u.title AS user, u.alias AS user_alias')->leftJoin('#__jkit_users AS u ON u.id = a.user_id'); $this->item = $db->setQuery($query_item)->loadObject(); // set item params and image $this->item->params = $this->item ? json_decode($this->item->params) : array(); $this->item->image = $imageHelper->getImage($id, 'items'); // get the item images $query_images = $db->getQuery(true)->select('*')->from('#__jkit_images')->where("item_id = {$id}")->where('state = 1')->order('ordering'); $images = $db->setQuery($query_images)->loadObjectList(); foreach ($images as $image) { $image->params = json_decode($image->params); if (isset($image->params->tags)) { $image->params->tags = array_keys(get_object_vars($image->params->tags)); } } $this->item->images = $images; // get the item tags $query_tags = $db->getQuery(true)->select('a.id, a.title, a.alias')->from('#__jkit_tags AS a')->innerJoin('#__jkit_tags_item AS t ON t.tag_id = a.id')->where("a.state = 1")->where("t.item_id = {$id}")->order('a.id'); $this->item->tags = $db->setQuery($query_tags)->loadObjectList(); // get item translation $lang = $db->quote(JFactory::getLanguage()->getTag()); $query_translation = $db->getQuery(true)->select('*')->from('#__jkit_translations')->where("ref_table = 'items'")->where("lang = {$lang}")->where("ref_id = {$id}"); $translation = $db->setQuery($query_translation)->loadObject(); if ($translation) { $this->item = JKitHelper::applyTranslation($this->item, $translation); } // get tags translations $tags_ids = array(); $tags_translations = array(); foreach ($this->item->tags as $tag) { $tags_ids[] = $tag->id; } if ($tags_ids) { $query_tags_translations = $db->getQuery(true)->select('*')->from('#__jkit_translations')->where("ref_table = 'tags'")->where("lang = {$lang}")->where("ref_id IN (" . implode(',', $tags_ids) . ")"); $tags_translations = $db->setQuery($query_tags_translations)->loadObjectList(); } if ($tags_translations) { foreach ($this->item->tags as $i => $tag) { foreach ($tags_translations as $tag_translation) { if ($tag->id == $tag_translation->ref_id) { $this->item->tags[$i]->title = $tag_translation->title; $this->item->tags[$i]->alias = $tag_translation->alias; } } } } // prepare content if ($prepare_content) { $this->item->intro = JHtml::_('content.prepare', $this->item->intro); $this->item->body = JHtml::_('content.prepare', $this->item->body); } return $this->item; }
/** * Search for transaltions and override items strings * @param type $items * @return type */ private function loadTranslations($items) { // get translations $lang = $this->_db->quote(JFactory::getLanguage()->getTag()); // get items transaltions $qids = implode(',', $this->items_ids); $query = $this->_db->getQuery(true)->select('*')->from('#__jkit_translations')->where("ref_table = 'items'")->where("lang = {$lang}"); $query->where("ref_id IN ({$qids})"); $translations = $this->_db->setQuery($query)->loadObjectList(); // load tags transaltions $translations_tags = array(); if (count($this->tags_ids)) { $tids = implode(',', $this->tags_ids); if ($tids) { $query_tags = $this->_db->getQuery(true)->select('*')->from('#__jkit_translations')->where("ref_table = 'tags'")->where("lang = {$lang}"); $query_tags->where("ref_id IN ({$tids})"); $translations_tags = $this->_db->setQuery($query_tags)->loadObjectList(); } } // assign items transaltions foreach ($items as $item) { if (count($translations)) { foreach ($translations as $translation) { if ($item->id == $translation->ref_id) { $item = JKitHelper::applyTranslation($item, $translation); } } } if (count($translations_tags) && count($item->tags)) { foreach ($translations_tags as $translation) { foreach ($item->tags as $tag) { if ($tag->id == $translation->ref_id) { $tag->title = $translation->title; $tag->alias = $translation->alias; } } } } // reorder item tags usort($item->tags, array('JKitModelItems', 'reorderTranslatedTags')); } // assign tags translation // TODO: merge in the first loop, no need for 2 loops if (count($this->tags) && count($translations_tags)) { foreach ($this->tags as $tag) { foreach ($translations_tags as $translation) { if ($tag->id == $translation->ref_id) { $tag->title = $translation->title; $tag->alias = $translation->alias; } } } // reorder translation tags usort($this->tags, array('JKitModelItems', 'reorderTranslatedTags')); } return $items; }
<?php /** * @package JKit * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ // defined('_JEXEC') or die; JHtml::_('formbehavior.chosen', 'select'); $context = 'types'; $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $types = JKitHelper::defaultTypes(); ?> <!-- adminForm --> <form action="<?php echo JRoute::_('index.php?option=com_jkit&view=' . $context); ?> " method="post" name="adminForm" id="adminForm"> <!-- sidebar --> <div id="j-sidebar-container" class="span2"> <?php echo $this->sidebar; ?> </div> <!-- /sidebar -->
<?php /** * @package JKit * @copyright Copyright (C) CloudHotelier. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/gpl.html> * @author Xavier Pallicer <*****@*****.**> */ defined('_JEXEC') or die; // load assets JKitHelper::loadAssets($this->params); // images $path_items = JURI::root() . 'images/jkit/items/'; ?> <article class="jkit-item"> <header> <div class="page-header"> <h1><?php echo $this->item->title; ?> </h1> </div> <?php if ($this->item->images) { ?> <?php echo $this->loadTemplate('slider_' . $this->params->get('slider', 'cycle2'));
?> <?php if ($this->item->tags) { ?> <div class="form-horizontal"> <fieldset> <legend><?php echo JText::_('COM_JKIT_ITEM_TAGS'); ?> </legend> <?php foreach ($this->item->tags as $i => $tag) { $field = "tag_" . $tag->id; $label = JText::_('COM_JKIT_ITEM_TAG') . ' #' . ($i + 1); JKitHelper::renderTranslateText($field, $tag->title, @$this->translation->data->{$field}, $label, $api_key); } ?> </fieldset> </div> <?php } ?> </div> </div> <!--/main --> </form>