Source for file mosvote.php

Documentation is available at mosvote.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @author Mambo Foundation Inc see README.php
  5. @copyright Mambo Foundation Inc.
  6. *  See COPYRIGHT.php for copyright notices and details.
  7. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see
  8. *  LICENSE.php
  9. *  Mambo is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU General Public License
  11. *  as published by the Free Software Foundation; version 2 of the
  12. *  License.
  13. */ 
  14.  
  15. /** ensure this file is being included by a parent file */
  16. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  17.  
  18. $this->registerFunction'onBeforeDisplayContent''botVoting' );
  19.  
  20. function botVoting&$row&$params$page={
  21.     global $mosConfig_live_site$mosConfig_absolute_path$cur_template;
  22.     global $Itemid;
  23.     if (strtolowerget_class($row) ) != strtolower'mosExtendedContent' )) return;
  24.     if (is_callable(array($row,'getId'))) $id $row->getId();
  25.     else $id $row->id;
  26.     $option 'com_content';
  27.     $task mosGetParam$_REQUEST'task''' );
  28.  
  29.     $html '';
  30.     if ($params->get'rating' && !$params->get'popup' )){
  31.         if (is_callable(array($row,'getRating'))) $rating $row->getRating();
  32.         else $rating $row->rating;
  33.         if (is_callable(array($row,'getRatingCount'))) $rating_count $row->getRatingCount();
  34.         else $rating_count $row->rating_count;
  35.         $html .= '<form method="post" action="' sefRelToAbs'index.php' '">';
  36.         $img '';
  37.         
  38.         // look for images in template if available
  39.         $mainframe =mosMainFrame::getInstance();
  40.         $starImageOn $mainframe->ImageCheck'rating_star.png''/images/M_images/' );
  41.         $starImageOff $mainframe->ImageCheck'rating_star_blank.png''/images/M_images/' );
  42.  
  43.         for ($i=0$i $rating$i++{
  44.             $img .= $starImageOn;
  45.         }
  46.         for ($i=$rating$i 5$i++{
  47.             $img .= $starImageOff;
  48.         }
  49.         $html .= '<span class="content_rating">';
  50.         $html .= T_('User Rating'':' $img '&nbsp;/&nbsp;';
  51.         $html .= intval$rating_count );
  52.         $html .= "</span>\n<br />\n";
  53.         $url @$_SERVER['REQUEST_URI'];
  54.         $url ampReplace$url );
  55.         
  56.         require_once(mamboCore::get('mosConfig_absolute_path').'/includes/phpInputFilter/class.inputfilter.php');
  57.         $iFilter new InputFilternullnull1);
  58.         $url trim$iFilter->process$url ) );
  59.         
  60.         if (!$params->get'intro_only' && $task != "blogsection"{
  61.             $html .= '<span class="content_vote">';
  62.             $html .= T_('Poor');
  63.             $html .= '<input type="radio" alt="'.T_('vote 1 star').'" name="user_rating" value="1" />';
  64.             $html .= '<input type="radio" alt="'.T_('vote 2 star').'" name="user_rating" value="2" />';
  65.             $html .= '<input type="radio" alt="'.T_('vote 3 star').'" name="user_rating" value="3" />';
  66.             $html .= '<input type="radio" alt="'.T_('vote 4 star').'" name="user_rating" value="4" />';
  67.             $html .= '<input type="radio" alt="'.T_('vote 5 star').'" name="user_rating" value="5" checked="checked" />';
  68.             $html .= T_('Best');
  69.             $html .= '&nbsp;<input class="button" type="submit" name="submit_vote" value="'T_('Rate'.'" />';
  70.             $html .= '<input type="hidden" name="task" value="vote" />';
  71.             $html .= '<input type="hidden" name="pop" value="0" />';
  72.             $html .= '<input type="hidden" name="option" value="com_content" />';
  73.             $html .= '<input type="hidden" name="Itemid" value="'$Itemid .'" />';
  74.             $html .= '<input type="hidden" name="cid" value="'$id .'" />';
  75.             $html .= '<input type="hidden" name="url" value="'$url .'" />';
  76.             $html .= '</span>';
  77.         }
  78.         $html .= "</form>\n";
  79.     }
  80.     return $html;
  81. }
  82. ?>

Documentation generated on Mon, 05 May 2008 16:21:34 +0400 by phpDocumentor 1.4.0