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

