View of /mambo/branches/4.6/mambots/content/mosvote.php
Parent Directory
|
Revision Log
Revision 1756 -
(download)
(annotate)
Thu May 28 06:41:09 2009 UTC (3 years, 11 months ago) by elpie
File size: 3560 byte(s)
Thu May 28 06:41:09 2009 UTC (3 years, 11 months ago) by elpie
File size: 3560 byte(s)
! Added back copyright date & note (which should not be needed, but which is) that copyright notices must be retained.
<?php
/**
* @package Mambo
* @author Mambo Foundation Inc see README.php
* @copyright (C) 2000 - 2009 Mambo Foundation Inc.
* See COPYRIGHT.php for copyright notices and details.
* @license GNU/GPL Version 2, see LICENSE.php
*
* Redistributions of files must retain the above copyright notice.
*
* Mambo is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the License.
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$this->registerFunction( 'onBeforeDisplayContent', 'botVoting' );
function botVoting( &$row, &$params, $page=0 ) {
global $mosConfig_live_site, $mosConfig_absolute_path, $cur_template;
global $Itemid;
if (strtolower( get_class($row) ) != strtolower( 'mosExtendedContent' )) return;
if (is_callable(array($row,'getId'))) $id = $row->getId();
else $id = $row->id;
$option = 'com_content';
$task = mosGetParam( $_REQUEST, 'task', '' );
$html = '';
if ($params->get( 'rating' ) && !$params->get( 'popup' )){
if (is_callable(array($row,'getRating'))) $rating = $row->getRating();
else $rating = $row->rating;
if (is_callable(array($row,'getRatingCount'))) $rating_count = $row->getRatingCount();
else $rating_count = $row->rating_count;
$html .= '<form method="post" action="' . sefRelToAbs( 'index.php' ) . '">';
$img = '';
// look for images in template if available
$mainframe =& mosMainFrame::getInstance();
$starImageOn = $mainframe->ImageCheck( 'rating_star.png', '/images/M_images/' );
$starImageOff = $mainframe->ImageCheck( 'rating_star_blank.png', '/images/M_images/' );
for ($i=0; $i < $rating; $i++) {
$img .= $starImageOn;
}
for ($i=$rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= T_('User Rating') . ':' . $img . ' / ';
$html .= intval( $rating_count );
$html .= "</span>\n<br />\n";
$url = @$_SERVER['REQUEST_URI'];
$url = ampReplace( $url );
require_once(mamboCore::get('mosConfig_absolute_path').'/includes/phpInputFilter/class.inputfilter.php');
$iFilter = new InputFilter( null, null, 1, 1 );
$url = trim( $iFilter->process( $url ) );
if (!$params->get( 'intro_only' ) && $task != "blogsection") {
$html .= '<span class="content_vote">';
$html .= T_('Poor');
$html .= '<input type="radio" alt="'.T_('vote 1 star').'" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="'.T_('vote 2 star').'" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="'.T_('vote 3 star').'" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="'.T_('vote 4 star').'" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="'.T_('vote 5 star').'" name="user_rating" value="5" checked="checked" />';
$html .= T_('Best');
$html .= ' <input class="button" type="submit" name="submit_vote" value="'. T_('Rate') .'" />';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="pop" value="0" />';
$html .= '<input type="hidden" name="option" value="com_content" />';
$html .= '<input type="hidden" name="Itemid" value="'. $Itemid .'" />';
$html .= '<input type="hidden" name="cid" value="'. $id .'" />';
//$html .= '<input type="hidden" name="url" value="'. $url .'" />';
$html .= '</span>';
}
$html .= "</form>\n";
}
return $html;
}
?>
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

