[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/modules/mod_poll/ -> helper.php (source)

   1  <?php
   2  /**
   3  * @version        $Id: helper.php 14401 2010-01-26 14:10:00Z louis $
   4  * @package        Joomla
   5  * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   6  * @license        GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined('_JEXEC') or die('Restricted access');
  16  
  17  class modPollHelper
  18  {
  19  	function getPoll($id)
  20      {
  21          $db        =& JFactory::getDBO();
  22          $result    = null;
  23  
  24          $query = 'SELECT id, title,'
  25              .' CASE WHEN CHAR_LENGTH(alias) THEN CONCAT_WS(\':\', id, alias) ELSE id END as slug '
  26              .' FROM #__polls'
  27              .' WHERE id = '.(int) $id
  28              .' AND published = 1'
  29              ;
  30          $db->setQuery($query);
  31          $result = $db->loadObject();
  32  
  33          if ($db->getErrorNum()) {
  34              JError::raiseWarning( 500, $db->stderr() );
  35          }
  36  
  37          return $result;
  38      }
  39  
  40  	function getPollOptions($id)
  41      {
  42          $db    =& JFactory::getDBO();
  43  
  44          $query = 'SELECT id, text' .
  45              ' FROM #__poll_data' .
  46              ' WHERE pollid = ' . (int) $id .
  47              ' AND text <> ""' .
  48              ' ORDER BY id';
  49          $db->setQuery($query);
  50  
  51          if (!($options = $db->loadObjectList())) {
  52              echo "MD ".$db->stderr();
  53              return;
  54          }
  55  
  56          return $options;
  57      }
  58  }
  59  ?>


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