コード例 #1
0
ファイル: view.html.php プロジェクト: atikahmed/joomla-probid
 function _displayForm($tpl)
 {
     $user =& JFactory::getUser();
     $option = JApplicationHelper::getComponentName();
     $model =& $this->getModel();
     $document =& JFactory::getDocument();
     $document->addStyleSheet('components/' . $option . '/assets/rokcandy.css');
     $lists = array();
     //get the rokcandymacro
     $rokcandymacro =& $this->get('data');
     $isNew = $rokcandymacro->id < 1;
     // fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('ROKCANDY_MACRO'), $rokcandymacro->macro);
         $app = JFactory::getApplication();
         $app->redirect('index.php?option=' . $option, $msg);
     }
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $rokcandymacro->published = 1;
         $rokcandymacro->order = 0;
         $rokcandymacro->catid = JRequest::getVar('catid', 0, 'post', 'int');
     }
     // build the html select list for ordering
     $query = 'SELECT ordering AS value, macro AS text' . ' FROM #__rokcandy' . ' WHERE catid = ' . (int) $rokcandymacro->catid . ' ORDER BY ordering';
     $lists['ordering'] = JHTML::_('list.specificordering', $rokcandymacro, $rokcandymacro->id, $query);
     // build list of categories
     //$lists['catid'] 			= JHTML::_('list.category',  'catid', $option, intval( $rokcandymacro->catid ) );
     $lists['catid'] = JElementRokCandyList::getCategories('catid', intval($rokcandymacro->catid));
     // build the html select list
     $publishList[] = JHTML::_('select.option', '1', JText::_('Published'));
     $publishList[] = JHTML::_('select.option', '0', JText::_('Unpublished'));
     $lists['published'] = JHTML::_('select.genericlist', $publishList, 'published', 'class="inputbox" size="1"', 'value', 'text', $rokcandymacro->published);
     //clean rokcandymacro data
     JFilterOutput::objectHTMLSafe($rokcandymacro, ENT_QUOTES, 'html');
     $file = JPATH_COMPONENT . DS . 'models' . DS . 'candymacro.xml';
     $params = new JParameter($rokcandymacro->params, $file);
     $this->assignRef('lists', $lists);
     $this->assignRef('rokcandymacro', $rokcandymacro);
     $this->assignRef('params', $params);
     parent::display($tpl);
 }
コード例 #2
0
ファイル: view.html.php プロジェクト: bizanto/Hooked
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $document->addStyleSheet('components/' . $option . '/assets/rokcandy.css');
     $filter_state = $mainframe->getUserStateFromRequest($option . 'filter_state', 'filter_state', '', 'word');
     $filter_catid = $mainframe->getUserStateFromRequest($option . 'filter_catid', 'filter_catid', 0, 'int');
     $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
     if ($filter_catid != -1) {
         $items =& $this->get('Data');
     } else {
         $items = array();
     }
     $total =& $this->get('Total');
     $pagination =& $this->get('Pagination');
     if ($filter_catid == -1 or $filter_catid == 0) {
         $overrides =& $this->get('TemplateOverrides');
     } else {
         $overrides = array();
     }
     // build list of categories
     $javascript = 'onchange="document.adminForm.submit();"';
     $lists['catid'] = JElementRokCandyList::getCategories('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);
     $this->assignRef('overrides', $overrides);
     parent::display($tpl);
 }