[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_poll/views/poll/ -> view.html.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: view.html.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @subpackage    Config
   6  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  jimport( 'joomla.application.component.view');
  19  
  20  /**
  21   * HTML View class for the Poll component
  22   *
  23   * @static
  24   * @package        Joomla
  25   * @subpackage    Poll
  26   * @since 1.0
  27   */
  28  class PollViewPoll extends JView
  29  {
  30  	function display($tpl = null)
  31      {
  32          global $mainframe;
  33  
  34          $db        =& JFactory::getDBO();
  35          $user     =& JFactory::getUser();
  36  
  37          $cid     = JRequest::getVar( 'cid', array(0), '', 'array' );
  38          $option = JRequest::getCmd( 'option');
  39          $uid     = (int) @$cid[0];
  40          $edit=JRequest::getVar( 'edit', true );
  41  
  42          $poll =& JTable::getInstance('poll', 'Table');
  43          // load the row from the db table
  44          if($edit)
  45          $poll->load( $uid );
  46  
  47          // fail if checked out not by 'me'
  48          if ($poll->isCheckedOut( $user->get('id') )) {
  49              $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The poll' ), $poll->title );
  50              $this->setRedirect( 'index.php?option='. $option, $msg );
  51          }
  52  
  53          if ($poll->id == 0)
  54          {
  55              // defaults
  56              $row->published    = 1;
  57          }
  58  
  59          $options = array();
  60  
  61          if ($edit)
  62          {
  63              $poll->checkout( $user->get('id') );
  64              $query = 'SELECT id, text'
  65              . ' FROM #__poll_data'
  66              . ' WHERE pollid = '.(int) $uid
  67              . ' ORDER BY id'
  68              ;
  69              $db->setQuery($query);
  70              $options = $db->loadObjectList();
  71          }
  72          else
  73          {
  74              $poll->lag = 3600*24;
  75          }
  76  
  77          $this->assignRef('poll',    $poll);
  78          $this->assignRef('options',    $options);
  79  
  80          parent::display($tpl);
  81  
  82      }
  83  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1