Ejemplo n.º 1
0
 /**
  * Downloads list view method
  * @return void
  **/
 function display($tpl = null)
 {
     // set a switch so we can build later a valid: db query
     $app = JFactory::getApplication();
     if ($this->getLayout() == 'modal' || $this->getLayout() == 'modallist') {
         $app->setUserState('jd_modal', true);
         // Load the backend helper
         require_once JPATH_ADMINISTRATOR . '/components/com_jdownloads/helpers/jdownloadshelper.php';
         // we must load the admin language here explicit
         $lang = JFactory::getLanguage();
         $locale = JDownloadsHelper::getLangKey();
         $lang->load('com_jdownloads', JPATH_ADMINISTRATOR, $locale, true);
     } else {
         $app->setUserState('jd_modal', false);
     }
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // create 'delete also file' option
     $filters = array();
     $filters[] = JHtml::_('select.option', '0', JText::_('NO'));
     $filters[] = JHtml::_('select.option', '1', JText::_('YES'));
     $this->delete_file_option = $filters;
     // create featured option
     $featured = array();
     $featured[] = JHtml::_('select.option', '', JText::_('COM_JDOWNLOADS_SELECT_FEATURED_STATUS'));
     $featured[] = JHtml::_('select.option', '1', JText::_('COM_JDOWNLOADS_FEATURED'));
     $featured[] = JHtml::_('select.option', '0', JText::_('COM_JDOWNLOADS_UNFEATURED'));
     $featured[] = JHtml::_('select.option', 'all', JText::_('COM_JDOWNLOADS_ALL'));
     $this->featured_option = $featured;
     // build categories list box
     $lists = array();
     $config = array('filter.published' => array(0, 1));
     $select[] = JHtml::_('select.option', 0, JText::_('COM_JDOWNLOADS_SELECT_CATEGORY'));
     $select[] = JHtml::_('select.option', 1, JText::_('COM_JDOWNLOADS_SELECT_UNCATEGORISED'));
     // get the categories data
     $categories = $this->getCategoriesList($config);
     $this->categories = @array_merge($select, $categories);
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal' && $this->getLayout() !== 'modallist') {
         $this->addToolbar();
         $this->sidebar = JHtmlSidebar::render();
     }
     parent::display($tpl);
 }