rate-it/templates/rateitbe_ratingview.html5
2014-10-01 07:19:14 +02:00

200 lines
7.7 KiB
Plaintext

<?php
/**
* Contao Open Source CMS
* Copyright (C) 2005-2011 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright cgo IT, 2013
* @author Carsten Götzinger (info@cgo-it.de)
* @package rateit
* @version 3.1.0 stable
* @license GNU/LGPL
* @filesource
*/
$rateit = &$this->rateit;
$theme = &$rateit->theme;
$text = &$GLOBALS['TL_LANG']['tl_rateit'];
$type_options = &$GLOBALS['TL_LANG']['tl_rateit_type_options'];
$active_options = &$GLOBALS['TL_LANG']['tl_rateit_active_options'];
$rating = &$rateit->ratingitems[0];
$label = $GLOBALS['TL_CONFIG']['rating_type'] == 'hearts' ? $GLOBALS['TL_LANG']['rateit']['heart'] : $GLOBALS['TL_LANG']['rateit']['star'];
$labels = $GLOBALS['TL_CONFIG']['rating_type'] == 'hearts' ? $GLOBALS['TL_LANG']['rateit']['hearts'] : $GLOBALS['TL_LANG']['rateit']['stars'];
?>
<div class="mod_rateit mod_rateit_view">
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawRatingsChart);
google.setOnLoadCallback(drawMonthsChart);
function drawRatingsChart() {
var data = new google.visualization.DataTable(<?php echo $rating->ratingsChartData; ?>);
var options = {
title: '<?php echo $text['rating_chart_legend'][0]; ?>',
is3D: true,
height: 350,
legend: {position: 'bottom'}
};
var chart = new google.visualization.PieChart(document.getElementById('chart_ratings'));
chart.draw(data, options);
}
function drawMonthsChart() {
var data = new google.visualization.DataTable(<?php echo $rating->monthsChartData; ?>);
var options = {
title: '<?php echo $text['month_chart_legend'][0]; ?>',
height: 350,
legend: {position: 'bottom'},
animation: {
duration: 1000
},
vAxes: [
{title: '<?php echo $text['month_chart_legend'][1]; ?>', minValue: 0},
{title: '<?php echo $text['month_chart_legend'][2]; ?>', minValue: 0, maxValue: <?php echo intval($GLOBALS['TL_CONFIG']['rating_count']); ?>}
],
hAxis: {title: '<?php echo $text['month_chart_legend'][3]; ?>'},
series: {
0: {type: "bars", targetAxisIndex: 0},
1: {type: "line", targetAxisIndex: 1}
}
};
var chart = new google.visualization.ComboChart(document.getElementById('chart_months'));
chart.draw(data, options);
}
</script>
<form action="<?php echo $rateit->f_link; ?>" id="rateit_editform" method="post">
<div class="tl_formbody">
<input type="hidden" name="rateit_action" value="<?php echo $rateit->f_action; ?>">
<input type="hidden" name="REQUEST_TOKEN" value="<?php echo REQUEST_TOKEN; ?>">
<div class="tl_panel">
<div class="tl_panel" style="border-bottom: none !important;">
<div class="tl_submit_panel tl_subpanel">
<input type="image" name="filter" id="filter" src="<?php echo TL_FILES_URL; ?>system/themes/<?php echo $this->getTheme(); ?>/images/reload.gif" class="tl_img_submit" title="<?php echo $text['apply']; ?>" alt="<?php echo $text['apply']; ?>">
</div>
<div class="tl_limit tl_subpanel">
<strong><?php echo $GLOBALS['TL_LANG']['MSC']['showOnly']; ?>:</strong>
<select name="rateit_details_page" id="rateit_details_page" class="tl_select<?php if ($rateit->f_page!=-1) echo ' active'; ?>" onchange="this.form.submit()">
<option value="0"><?php echo $GLOBALS['TL_LANG']['MSC']['filterRecords']; ?></option>
<?php for ($page=0; $page<count($rateit->pages); $page++): ?>
<option value="<?php echo $page; ?>"<?php if ($rateit->f_page==$page) echo ' selected="selected"'; ?>><?php echo $rateit->pages[$page]; ?></option>
<?php endfor; ?>
<option value="-1"<?php if ($rateit->f_page<0) echo ' selected="selected"'; ?>><?php echo $GLOBALS['TL_LANG']['MSC']['filterAll']; ?></option>
</select>
</div>
</div>
<div class="clear"></div>
</div>
<div id="tl_buttons">
<a onclick="Backend.getScrollOffset()" accesskey="n" class="header_export_excel" title="Export nach Excel" href="<?php echo $rateit->exportLink; ?>">Excel-Export</a> <a href="<?php echo $rateit->backLink; ?>" class="header_back" title="<?php echo $text['goback']; ?>" accesskey="b" onclick="Backend.getScrollOffset()"><?php echo $text['goback']; ?></a>
</div>
</div>
</form>
<div class="rating_container">
<table class="rating">
<tr class="title">
<th colspan="4"><span class="title"><?php echo $rating->title; ?></span></th>
</tr>
<tr class="spacer"><td colspan="4" class="spacer">&nbsp;</td></tr>
<tr>
<th class="viewcol1"><?php echo $text['title'][0]; ?></th>
<td class="viewcol2"><?php echo $rating->title; ?></td>
<th class="viewcol3"><?php echo $text['typ'][0]; ?></th>
<td class="type-<?php echo $rating->typ; ?>"><?php echo $type_options[$rating->typ]; ?></td>
</tr>
<tr>
<th><?php echo $text['createdat'][0]; ?></th>
<td><?php echo $this->parseDate($GLOBALS['TL_CONFIG']['dateFormat'], $rating->createdat); ?></td>
<th><?php echo $text['status'][0]; ?></th>
<td class="active-<?php echo $rating->active; ?>"><?php echo $active_options[$rating->active]; ?></td>
</tr>
<tr>
<th><?php echo property_exists($rating, 'rating') ? $text['overall_rating'][0] : '&nbsp;'; ?></th>
<td class="nowrap"><?php if (property_exists($rating, 'rating')): ?><div class="ratebarframe"><div class="ratebar" style="width:<?php echo number_format($rating->percent,12,'.',','); ?>%"></div></div> <div class="ratebartext"><?php echo sprintf($text['ratingfmt'], str_replace(".", ",", $rating->rating), $rating->stars, $rating->totalRatings); ?></div><?php endif; ?></td>
<th>&nbsp;</th>
<td>&nbsp;</td>
</tr>
<tr class="spacer"><td colspan="4" class="spacer">&nbsp;</td></tr>
<tr>
<th colspan="4"><?php echo $text['statistics'][0]; ?></th>
</tr>
<tr>
<td colspan="4">
<table class="rating">
<tr>
<td class="w50 h100"><div id="chart_ratings" class="chart"/></td>
<td class="w50 h100"><div id="chart_months" class="chart"/></td>
</tr>
</table>
</td>
</tr>
<tr class="spacer"><td colspan="4" class="spacer">&nbsp;</td></tr>
<tr>
<th colspan="4"><?php echo $text['ratings'][0]; ?></th>
</tr>
<tr>
<td colspan="4">
<?php if (count($rating->ratings) < 1): ?>
<p><?php echo $text['noratingsfound']; ?></p>
<?php else: ?>
<table class="rating">
<tr>
<th><?php echo $text['ip'][0]; ?></th>
<th><?php echo $text['member'][0]; ?></th>
<th><?php echo $text['rating'][0]; ?></th>
<th><?php echo $text['createdatdetail'][0]; ?></th>
</tr>
<?php foreach($rating->ratings as $r) : ?>
<tr>
<td><?php echo $r->ip; ?></td>
<td><?php echo $r->member; ?></td>
<td><div class="ratebarframe"><div class="ratebar" style="width:<?php echo number_format($r->percent,12,'.',','); ?>%"></div></div> <div class="ratebartext"><?php echo sprintf($text['ratingviewfmt'], str_replace(".", ",", $r->rating), $rating->stars).' '.$labels; ?></div></td>
<td><?php echo $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $r->createdat); ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</td>
</tr>
</table>
</div>
</div>