Annotation of /mambo/branches/4.6/mambots/content/mosvote.php
Parent Directory
|
Revision Log
Revision 213 - (view) (download)
| 1 : | root | 1 | <?php |
| 2 : | /** | ||
| 3 : | * @version $Id: mosvote.php,v 1.1 2005/07/22 01:57:49 eddieajau Exp $ | ||
| 4 : | * @package Mambo | ||
| 5 : | * @copyright (C) 2000 - 2005 Miro International Pty Ltd | ||
| 6 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 7 : | * Mambo is Free Software | ||
| 8 : | */ | ||
| 9 : | |||
| 10 : | /** ensure this file is being included by a parent file */ | ||
| 11 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 12 : | |||
| 13 : | mambo | 117 | $this->registerFunction( 'onBeforeDisplayContent', 'botVoting' ); |
| 14 : | root | 1 | |
| 15 : | function botVoting( &$row, &$params, $page=0 ) { | ||
| 16 : | global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template; | ||
| 17 : | global $Itemid; | ||
| 18 : | counterpoi | 213 | t if (get_class($row) != 'mosExtendedContent') return; |
| 19 : | t if (is_callable(array($row,'getId'))) $id = $row->getId(); | ||
| 20 : | t else $id = $row->id; | ||
| 21 : | root | 1 | $option = 'com_content'; |
| 22 : | $task = mosGetParam( $_REQUEST, 'task', '' ); | ||
| 23 : | |||
| 24 : | $html = ''; | ||
| 25 : | if ($params->get( 'rating' ) && !$params->get( 'popup' )){ | ||
| 26 : | counterpoi | 213 | t if (is_callable(array($row,'getRating'))) $rating = $row->getRating(); |
| 27 : | t else $rating = $row->rating; | ||
| 28 : | t if (is_callable(array($row,'getRatingCount'))) $rating_count = $row->getRatingCount(); | ||
| 29 : | t else $rating_count = $row->rating_count; | ||
| 30 : | root | 1 | $html .= '<form method="post" action="' . sefRelToAbs( 'index.php' ) . '">'; |
| 31 : | $img = ''; | ||
| 32 : | |||
| 33 : | // look for images in template if available | ||
| 34 : | mambo | 117 | $mainframe = mosMainFrame::getInstance(); |
| 35 : | $starImageOn = $mainframe->ImageCheck( 'rating_star.png', '/images/M_images/' ); | ||
| 36 : | $starImageOff = $mainframe->ImageCheck( 'rating_star_blank.png', '/images/M_images/' ); | ||
| 37 : | root | 1 | |
| 38 : | counterpoi | 213 | t for ($i=0; $i < $rating; $i++) { |
| 39 : | root | 1 | $img .= $starImageOn; |
| 40 : | } | ||
| 41 : | counterpoi | 213 | t for ($i=$rating; $i < 5; $i++) { |
| 42 : | root | 1 | $img .= $starImageOff; |
| 43 : | } | ||
| 44 : | $html .= '<span class="content_rating">'; | ||
| 45 : | csouza | 39 | $html .= T_('User Rating') . ':' . $img . ' / '; |
| 46 : | counterpoi | 213 | t $html .= intval( $rating_count ); |
| 47 : | root | 1 | $html .= "</span>\n<br />\n"; |
| 48 : | $url = @$_SERVER['REQUEST_URI']; | ||
| 49 : | $url = ampReplace( $url ); | ||
| 50 : | |||
| 51 : | if (!$params->get( 'intro_only' ) && $task != "blogsection") { | ||
| 52 : | $html .= '<span class="content_vote">'; | ||
| 53 : | csouza | 39 | $html .= T_('Poor'); |
| 54 : | csouza | 194 | $html .= '<input type="radio" alt="'.T_('vote 1 star').'" name="user_rating" value="1" />'; |
| 55 : | $html .= '<input type="radio" alt="'.T_('vote 2 star').'" name="user_rating" value="2" />'; | ||
| 56 : | $html .= '<input type="radio" alt="'.T_('vote 3 star').'" name="user_rating" value="3" />'; | ||
| 57 : | $html .= '<input type="radio" alt="'.T_('vote 4 star').'" name="user_rating" value="4" />'; | ||
| 58 : | $html .= '<input type="radio" alt="'.T_('vote 5 star').'" name="user_rating" value="5" checked="checked" />'; | ||
| 59 : | csouza | 39 | $html .= T_('Best'); |
| 60 : | $html .= ' <input class="button" type="submit" name="submit_vote" value="'. T_('Rate') .'" />'; | ||
| 61 : | root | 1 | $html .= '<input type="hidden" name="task" value="vote" />'; |
| 62 : | $html .= '<input type="hidden" name="pop" value="0" />'; | ||
| 63 : | $html .= '<input type="hidden" name="option" value="com_content" />'; | ||
| 64 : | $html .= '<input type="hidden" name="Itemid" value="'. $Itemid .'" />'; | ||
| 65 : | $html .= '<input type="hidden" name="cid" value="'. $id .'" />'; | ||
| 66 : | $html .= '<input type="hidden" name="url" value="'. $url .'" />'; | ||
| 67 : | $html .= '</span>'; | ||
| 68 : | } | ||
| 69 : | $html .= "</form>\n"; | ||
| 70 : | } | ||
| 71 : | return $html; | ||
| 72 : | } | ||
| 73 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

