public function display($tpl = null) { $this->form = $this->get('Form'); $this->model = $this->getModel(); JTable::addIncludePath(JPATH_COMPONENT . '/tables'); $mainframe = JFactory::getApplication(); $cid = JRequest::getVar("cid"); if (is_array($cid)) { $cid = $cid[0]; } $item = JTable::getInstance("document", "OSDownloadsTable"); $item->load($cid); if ($item->description_1) { $item->description_1 = $item->brief . "<hr id=\"system-readmore\" />" . $item->description_1; } else { $item->description_1 = $item->brief; } $this->form->bind($item); // Load the extension $extension = Factory::getExtension('OSDownloads', 'component'); $extension->loadLibrary(); // Add the agreementLink property if (!empty($item)) { $item->agreementLink = ''; if ((bool) $item->require_agree) { $item->agreementLink = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $item->agreement_article_id); } } $this->assignRef("item", $item); $this->assignRef("extension", $extension); $this->addToolbar(); parent::display($tpl); }
public function display($tpl = null) { $app = JFactory::getApplication(); $model = $this->getModel(); $db = JFactory::getDBO(); $pagination = $model->getPagination(); $query = $model->getItemsQuery(); $db->setQuery($query, $pagination->limitstart, $pagination->limit); $items = $db->loadObjectList(); $filterOrder = $app->getUserStateFromRequest("com_osdownloads.document.filter_order", 'filter_order', 'doc.id', ''); $filterOrderDir = $app->getUserStateFromRequest("com_osdownloads.document.filter_order_Dir", 'filter_order_Dir', 'asc', 'word'); $lists = array(); $lists['order_Dir'] = $filterOrderDir; $lists['order'] = $filterOrder; $filter = new stdClass(); $filter->search = $app->getUserStateFromRequest('com_osdownloads.document.request.search', 'search'); $filter->categoryId = $app->getUserStateFromRequest('com_osdownloads.document.request.cate_id', 'flt_cate_id'); // Load the extension $extension = Alledia\Framework\Factory::getExtension('OSDownloads', 'component'); $extension->loadLibrary(); // jQuery warning for J2.5 users if (version_compare(JVERSION, '3.0', 'lt')) { $params = JComponentHelper::getParams('com_osdownloads'); if (!(bool) $params->get('load_jquery', 0)) { $app->enqueueMessage(JText::_('COM_OSDOWNLOADS_JQUERY_REQUIRED_WARNING'), 'warning'); } } // Add the agreementLink property if (!empty($items)) { foreach ($items as &$item) { $item->agreementLink = ''; if ((bool) $item->require_agree) { $item->agreementLink = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $item->agreement_article_id); } } } $this->assignRef('lists', $lists); $this->assignRef("items", $items); $this->assignRef("filter", $filter); $this->assignRef("pagination", $pagination); $this->assignRef("extension", $extension); $this->addToolbar(); parent::display($tpl); }