예제 #1
0
 /**
  * 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);
 }
예제 #2
0
 /**
  * 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);
 }
예제 #3
0
 /**
  * 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();
     // check item
     if (!$this->item) {
         if (!$item_id) {
             // component view
             throw new Exception(JText::_('COM_JKIT_ERROR_ITEM_NOT_FOUND'), 404);
         } else {
             // item loaded by a module
             return null;
         }
     }
     // 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 = JKit::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;
 }
예제 #4
0
								<div class="pull-left">
									<?php 
        if ($item->checked_out) {
            ?>
										<?php 
            echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, $context . '.', $canCheckin);
            ?>
									<?php 
        }
        ?>
									<a href="<?php 
        echo JRoute::_('index.php?option=com_jkit&task=user.edit&id=' . $item->id);
        ?>
">
										<?php 
        if ($imageHelper->getImage($item->id, $context)) {
            ?>
											<?php 
            echo '<img class="thumbnail pull-left jkit-images-thumb" src="' . $image_path . $item->id . '-tiny.jpg?' . rand(1, 999) . '" />';
            ?>
										<?php 
        }
        ?>
										<?php 
        echo $this->escape($item->title);
        ?>
									</a>
									<div class="small"><?php 
        echo $this->escape($item->first_name) . ' ' . $this->escape($item->last_name);
        ?>
</div>
예제 #5
0
파일: items.php 프로젝트: radabass/JKit
 /**
  * Prepare items: decode params and preapre to assign tags and images
  * @param type $items
  * @return type
  */
 private function loadProperties($items)
 {
     // load image helper
     $imageHelper = new JKitHelperImage(JComponentHelper::getParams('com_jkit'));
     // get ids and arrange params
     $ids = array();
     foreach ($items as $item) {
         $ids[] = $item->id;
         $item->intro = JHtml::_('content.prepare', $item->intro);
         $item->body = JHtml::_('content.prepare', $item->body);
         $item->params = json_decode($item->params);
         $item->image = $imageHelper->getImage($item->id, 'items');
         $item->images = array();
         $item->tags = array();
     }
     // global items_ids
     $this->items_ids = $ids;
     return $items;
 }
예제 #6
0
						<?php 
    if ($this->{$panel}) {
        ?>

							<?php 
        foreach ($this->{$panel} as $item) {
            ?>
								<div class="row-striped">
									<div class="row-fluid">
										<div class="span9">
											<a href="<?php 
            echo JRoute::_('index.php?option=com_jkit&task=item.edit&id=' . $item->id);
            ?>
">
												<?php 
            if ($imageHelper->getImage($item->id, 'items')) {
                ?>
													<?php 
                echo '<img class="thumbnail pull-left jkit-images-thumb" src="' . $path_items . $item->id . '-tiny.jpg?' . rand(1, 999) . '" />';
                ?>
												<?php 
            }
            ?>
												<?php 
            echo $this->escape($item->title);
            ?>
											</a>
											<div class="small">
												<?php 
            echo JText::_('JCATEGORY') . ": " . $this->escape($item->category);
            ?>