Esempio n. 1
0
 public function display($tpl = null)
 {
     // Give a warning if no categories are configured
     SimplelistsHelper::checkCategories();
     // Fetch the item automatically
     $this->fetchItem(true);
     // Modify the item a bit
     $this->item->image_default_folder = COM_SIMPLELISTS_DIR;
     $this->item->image_default_uri = COM_SIMPLELISTS_BASEURL;
     $this->item->picture_folder = $this->item->image_default_folder;
     $this->item->picture_uri = $this->item->image_default_uri;
     $this->item->picture_path = null;
     if (!empty($this->item->picture)) {
         $this->item->picture_path = JPATH_SITE . DS . $this->item->picture;
         $this->item->picture_uri = str_replace(DS, '/', $this->item->picture);
         $this->item->picture_folder = dirname($this->item->picture_uri);
     }
     // Add extra filtering lists
     $defaultCategory = $this->item->id == 0 ? (int) $this->getFilter('category_id', null, null, 'com_simplelists_items_') : null;
     $categories_params = array('item_id' => $this->item->id, 'multiple' => 1, 'current' => $defaultCategory);
     $this->lists['categories'] = SimplelistsHTML::selectCategories('categories[]', $categories_params);
     // Construct the modal boxes
     $modal = array();
     $modal['picture'] = 'index.php?option=com_simplelists&view=files&tmpl=component&type=picture&current=' . $this->item->picture;
     if ($this->item->picture) {
         $modal['picture'] .= '&folder=' . $this->item->picture_folder;
     }
     $this->assignRef('modal', $modal);
     // Construct the slider-panel
     jimport('joomla.html.pane');
     $pane =& JPane::getInstance('sliders');
     $this->assignRef('pane', $pane);
     // Include extra JavaScript
     $this->addJs('mootools-cookie.js');
     $this->addJs('view-browser.js');
     // Load the plugins
     $link_plugins = SimplelistsPluginHelper::getPlugins('simplelistslink');
     $this->assignRef('link_plugins', $link_plugins);
     // Add extra stuff
     JHTML::_('behavior.tooltip');
     JHTML::_('behavior.modal', 'a.modal-button');
     parent::display($tpl);
 }
Esempio n. 2
0
 public function _prepareItem($item, $layout)
 {
     // Get system variables
     $user =& JFactory::getUser();
     $dispatcher =& JDispatcher::getInstance();
     $params = $this->params;
     // Run the content through Content Plugins
     if ($item->params->get('enable_content_plugins', 1) == 1) {
         JPluginHelper::importPlugin('content');
         $iparams = array();
         $results = $dispatcher->trigger('onPrepareContent', array(&$item, &$iparams, 0));
     }
     // Disable the text when needed
     if ($item->params->get('show_item_text', 1) == 0) {
         $item->text = null;
     }
     // Prepare the URL
     $item->url = JRoute::_(SimplelistsPluginHelper::getPluginLinkUrl($item));
     if ($item->alias) {
         $item->href = $item->alias;
     } else {
         $item->href = 'item' . $item->id;
     }
     // Create a simple target-string
     switch ($item->params->get('target')) {
         case 1:
             $item->target = ' target="_blank"';
             break;
         case 2:
             $item->target = ' onclick="javascript: window.open(\'' . $item->url . '\', \'\', \'toolbar=no,location=no,status=no,' . 'menubar=no,scrollbars=yes,resizable=yes,width=780,height=550\'); return false"';
             break;
         default:
             $item->target = false;
             break;
     }
     // Set the readmore link for this item
     if ($item->params->get('readmore') == 1 && $item->url) {
         $readmore_text = $item->params->get('readmore_text', JText::sprintf('Read more', $item->title));
         $readmore_css = trim('readon ' . $item->params->get('readmore_class', ''));
         $item->readmore = JHTML::link($item->url, $readmore_text, 'title="' . $item->title . '" class="' . $readmore_css . '"' . $item->target);
     } else {
         $item->readmore = null;
     }
     // Set the image-alignment for this item
     if ($item->params->get('picture_alignment') != '' && $layout != 'picture') {
         $item->picture_alignment = ' align="' . $item->params->get('picture_alignment') . '"';
     } else {
         $item->picture_alignment = null;
     }
     // Prepare the image
     if ($item->params->get('show_item_image', 1) && !empty($item->picture)) {
         $attributes = 'title="' . $item->title . '" class="simplelists"' . $item->picture_alignment;
         $item->picture = SimplelistsHTML::image($item->picture, $item->title, $attributes);
     } else {
         $item->picture = null;
     }
     // Prepare the title
     if ($item->params->get('show_item_title', 1)) {
         if ($item->params->get('title_link') && !empty($item->url)) {
             $item->title = JHTML::link($item->url, $item->title, $item->target);
         }
     } else {
         $item->title = null;
     }
     // Set specific layout settings
     $item->style = '';
     if ($layout == 'select' || $layout == 'hover') {
         if (empty($firstflag)) {
             static $firstflag = 1;
             $item->style = 'display:block; visibility:visible;';
         }
     }
     // Enable parsing the content
     JPluginHelper::importPlugin('content');
     $results = $dispatcher->trigger('onBeforeDisplayContent', array(&$item, &$item->params, 0));
     foreach ($results as $result) {
         if (!empty($result)) {
             $item->text .= $result;
         }
     }
     return $item;
 }
Esempio n. 3
0
        ?>
                </td>
                <td>
                    <?php 
        if ($item->link_type == 4) {
            ?>
                        <a class="modal" href="/<?php 
            echo $item->link;
            ?>
"><?php 
            echo basename($item->link);
            ?>
</a>
                        <?php 
        } else {
            echo SimplelistsPluginHelper::getPluginLinkName($item);
        }
        ?>
                </td>
				<td align="center">
					<?php 
        echo $item->accesslevel;
        ?>
				</td>
                <td align="center">
                    <?php 
        echo $item->hits;
        ?>
                </td>
                <td align="center">
                    <?php 
Esempio n. 4
0
 /**
  * Method to load data
  *
  * @access public
  * @param null
  * @return boolean
  */
 public function getData()
 {
     // Lets load the content if it doesn't already exist
     $this->_data = parent::getData();
     // If these data exist, add extra info
     if (empty($this->_data)) {
         // Fetch the extra link data
         if (!isset($this->_data->link_data)) {
             $this->_data->link_data = array();
             if (!empty($this->_data->link_type)) {
                 $plugin = SimplelistsPluginHelper::getPlugin('simplelistslink', $this->_data->link_type);
                 if (!empty($plugin)) {
                     $this->_data->link_data[$this->_data->link_type] = $plugin->getName($this->_data->link);
                 }
             }
         }
     }
     return $this->_data;
 }