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

