function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_mijopolls/assets/css/mijopolls.css');
     $title = $this->get('Title');
     $t_title = $title ? JText::_('COM_MIJOPOLLS_VOTES_FOR') . ': ' . $title : JText::_('COM_MIJOPOLLS_SELECT_POLL');
     JToolBarHelper::title($t_title, 'mijopolls');
     JToolBarHelper::deleteList(JText::_('COM_MIJOPOLLS_DELETE_CONFIRM'), "deleteVotes", JText::_('COM_MIJOPOLLS_DELETE'), true);
     JToolBarHelper::divider();
     JToolBarHelper::preferences('com_mijopolls', 500);
     $this->mainframe = JFactory::getApplication();
     $this->option = JRequest::getWord('option');
     $filter_order = $this->mainframe->getUserStateFromRequest($this->option . '.votes.filter_order', 'filter_order', 'v.date', 'cmd');
     $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . '.votes.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $this->mainframe->getUserStateFromRequest($this->option . '.votes.search', 'search', '', 'string');
     // Get data from the model
     $lists = $this->get('List');
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->title = $title;
     $this->lists = $lists;
     $this->votes = $this->get('Data');
     $this->pagination = $this->get('Pagination');
     $this->poll_id = JRequest::getInt('id', 0);
     parent::display($tpl);
 }
예제 #2
0
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_mijopolls/assets/css/mijopolls.css');
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $edit = JRequest::getVar('edit', true);
     $text = $edit ? JText::_('Edit') : JText::_('New');
     JToolBarHelper::title(JText::_('COM_MIJOPOLLS_POLL') . ': <small><small>[ ' . $text . ' ]</small></small>', 'mijopolls');
     JToolBarHelper::Preview('index.php?option=com_mijopolls&cid[]=' . $cid[0]);
     JToolBarHelper::save();
     JToolBarHelper::apply();
     JToolBarHelper::cancel();
     $this->mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $row = $this->get('ItemData');
     // fail if checked out not by 'me'
     if ($row->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('COM_MIJOPOLLS_THE_POLL'), $row->title);
         $this->setRedirect('index.php?option=com_mijopolls', $msg);
     }
     if ($row->id == 0) {
         $row->published = 1;
     }
     $options = array();
     $ordering = array();
     if ($edit) {
         $options = $row->getOptions($row->id);
     } else {
         $row->lag = 24 * 60;
     }
     //default colors for slices
     $colors = array("ff0000", "ffff99", "00ccff", "66ff99", "ffcc00", "d7ebff", "ccffcc", "cccccc", "ffff00", "006699", "660000", "ffddee");
     $task = JRequest::getCmd('task');
     if (MijopollsHelper::is15()) {
         $tpl .= '15';
         $params = new JParameter($row->params, JPATH_COMPONENT . '/views/poll/poll.xml');
         $this->params = $params;
     } else {
         if (MijopollsHelper::is30()) {
             $tpl = '30';
             $this->params = $this->get('Form');
         } else {
             if ($task != 'preview') {
                 $tpl = '25';
                 $this->params = $this->get('Form');
             }
         }
     }
     $this->row = $row;
     $this->options = $options;
     $this->color = $colors;
     $this->edit = $edit;
     parent::display($tpl);
 }
 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/com_mijopolls/assets/css/mijopolls.css');
     JToolBarHelper::title(JText::_('COM_MIJOPOLLS_POLLS'), 'mijopolls');
     JToolBarHelper::addNew();
     JToolBarHelper::editList();
     JToolBarHelper::deleteList();
     JToolBarHelper::divider();
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::divider();
     JToolBarHelper::custom('resetVotes', 'cancel.png', 'cancel.png', JText::_('COM_MIJOPOLLS_RESET_VOTES'), true, false);
     JToolBarHelper::preferences('com_mijopolls', 500);
     $this->mainframe = JFactory::getApplication();
     $this->option = JRequest::getWord('option');
     $filter_order = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order', 'filter_order', 'm.title', 'string');
     $filter_order_Dir = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_order_Dir', 'filter_order_Dir', '', 'word');
     $filter_state = $this->mainframe->getUserStateFromRequest($this->option . '.polls.filter_state', 'filter_state', '', 'word');
     $search = $this->mainframe->getUserStateFromRequest($this->option . '.polls.search', 'search', '', 'string');
     JHTML::_('behavior.tooltip');
     // 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->user = JFactory::getUser();
     $this->lists = $lists;
     $this->items = $this->get('Data');
     $this->pagination = $this->get('Pagination');
     if (MijopollsHelper::is30()) {
         $tpl = '30';
     }
     parent::display($tpl);
 }