function display($tpl = null) { global $mainframe, $option; $db =& JFactory::getDBO(); $uri =& JFactory::getURI(); $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word'); $filter_catid = $mainframe->getUserStateFromRequest($option . 'filter_catid', 'filter_catid', 0, 'int'); $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'a.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model $items =& $this->get('Data'); $total =& $this->get('Total'); $pagination =& $this->get('Pagination'); // build list of categories $javascript = 'onchange="document.adminForm.submit();"'; $lists['catid'] = JHTML::_('form.category', 'filter_catid', $option, intval($filter_catid), $javascript); // state filter $lists['state'] = JHTML::_('grid.state', $filter_state); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->assignRef('user', JFactory::getUser()); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); parent::display($tpl); }
function _displayForm($tpl) { global $mainframe, $option; $db =& JFactory::getDBO(); $uri =& JFactory::getURI(); $user =& JFactory::getUser(); $model =& $this->getModel(); $component = JComponentHelper::getComponent('com_picman'); $params = new JParameter($component->params); $lists = array(); //get the album $album =& $this->get('data'); $isNew = $album->id < 1; if (!($albumsList =& $this->get('AlbumsList'))) { //echo "<script> alert('Error'); </script>\n"; } // fail if checked out not by 'me' if ($model->isCheckedOut($user->get('id'))) { $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The album'), $album->title); $mainframe->redirect('index.php?option=' . $option, $msg); } // Edit or Create? if (!$isNew) { $model->checkout($user->get('id')); } else { // initialise new record $album->published = 1; $album->catid = JRequest::getVar('catid', 0, 'post', 'int'); } // build list of categories $lists['catid'] = JHTML::_('form.category', 'catid', $option, $album->catid, ''); // build the html select list $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $album->published); // build list of albums - hide when username is blank or wrong if (isset($albumsList)) { $lists['album'] = JHTML::_('select.genericlist', $albumsList, 'albumid', '', 'value', 'text', $album->albumid); } $this->assignRef('lists', $lists); $this->assignRef('album', $album); $this->assignRef('params', $params); parent::display($tpl); }
function display($tpl = null) { global $mainframe, $option; $db =& JFactory::getDBO(); $uri =& JFactory::getURI(); $filter_order = $mainframe->getUserStateFromRequest($option . 'categories-filter_order', 'filter_order', 'category.ordering', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'categories-filter_order_Dir', 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest($option . 'categories-search', 'search', '', 'string'); $search = JString::strtolower($search); // Get data from the model $items =& $this->get('Data'); $total =& $this->get('Total'); $pagination =& $this->get('Pagination'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $lists['search'] = $search; $this->assignRef('user', JFactory::getUser()); $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); parent::display($tpl); }