rate-it/templates/rateitbe_ratinglist.html5

183 lines
7.6 KiB
Plaintext
Raw Normal View History

2014-10-01 07:19:14 +02:00
<?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'];
$order_options = &$GLOBALS['TL_LANG']['tl_rateit_order_options'];
?>
<div class="mod_rateit">
<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_filter tl_subpanel">
<strong><?php echo $GLOBALS['TL_LANG']['MSC']['filter']; ?>:</strong>
<select name="rateit_typ" id="rateit_typ" class="tl_select<?php if ($rateit->f_type!='') echo ' active'; ?>">
<option value=""><?php echo $text['seltyp'][0]; ?></option>
<option value="">---</option>
<?php foreach ($type_options as $k=>$v): ?>
<option value="<?php echo $k; ?>"<?php if (strcasecmp($rateit->f_typ, $k) == 0) echo ' selected="selected"'; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
<select name="rateit_active" id="rateit_active" class="tl_select<?php if ($rateit->f_active!='') echo ' active'; ?>">
<option value=""><?php echo $text['selactive'][0]; ?></option>
<option value="">---</option>
<?php foreach ($active_options as $k=>$v): ?>
<option value="<?php echo $k; ?>"<?php if (strcasecmp($rateit->f_active, $k) == 0) echo ' selected="selected"'; ?>><?php echo $v; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="clear"></div>
</div>
<div class="tl_panel">
<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_page" id="rateit_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 class="tl_search tl_subpanel">
<strong><?php echo $GLOBALS['TL_LANG']['MSC']['search']; ?>:</strong>
<input type="text" name="rateit_find" id="rateit_find" value="<?php echo specialchars($rateit->f_find); ?>" class="tl_text fulltextsearch<?php if ($rateit->f_find!='') echo ' active'; ?>"/>
</div>
<div class="tl_sorting tl_subpanel">
<strong><?php echo $GLOBALS['TL_LANG']['MSC']['sortBy']; ?>:</strong>
<select name="rateit_order" id="rateit_order" class="tl_select">
<?php foreach (array_keys($order_options) as $oby): ?>
<option value="<?php echo $oby; ?>"<?php if ($rateit->f_order==$oby) echo ' selected="selected"'; ?>><?php echo sprintf($text['byorder'], $order_options[$oby]); ?></option>
<?php endforeach; ?>
</select>
</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>
</div>
</div>
</form>
<div class="rating_container">
<form action="<?php echo $rateit->f_link; ?>" id="rateit_clearform" method="post" >
<input type="hidden" name="act" value="reset_ratings">
<input type="hidden" name="REQUEST_TOKEN" value="<?php echo REQUEST_TOKEN; ?>">
<?php if (count($rateit->ratingitems) < 1): ?>
<p><?php echo $text['noratingsfound']; ?></p>
<?php else: ?>
<div>
<table class="rating-selectall">
<th class="selectall"><input type="checkbox" id="selectall" onclick="selectUnselectAll()">
</table>
</div>
<?php foreach ($rateit->ratingitems as $rating): ?>
<table class="rating">
<tr class="title">
<th colspan="4"><span class="leftblock"><input type="checkbox" name="selectedids[]" value="<?php echo $rating->rkey; ?>__<?php echo $rating->typ; ?>" onclick="enableSelectFunctions()">&nbsp;<a href="<?php echo $rating->viewLink; ?>" title="<?php echo $text['showdetails']; ?>"><?php echo $rating->title; ?></a></span> <span class="rightblock"><?php echo $theme->createListButton('info', $rating->viewLink, $text['showdetails']); ?></span></th>
</tr>
<tr class="info">
<th class="listcol1"><?php echo $text['title'][0]; ?></th>
<td class="listcol2"><?php echo $rating->title; ?></td>
<th class="listcol3"><?php echo $text['typ'][0]; ?></th>
<td class="type-<?php echo $rating->typ; ?>"><?php echo $type_options[$rating->typ]; ?></td>
</tr>
<tr class="info">
<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 class="info">
<th><?php echo property_exists($rating, 'rating') ? $text['rateit'][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>
</table>
<?php endforeach; ?>
<div class="tl_formbody_submit">
<div class="tl_submit_container">
<input type="submit" name="rateit_clearbutton" id="rateit_clearbutton" class="tl_submit" value="<?php echo $text['clearratings']; ?>">
</div>
</div>
<?php endif; ?>
</div>
</form>
</div>
<script>
function enableSelectFunctions() {
var sel = false;
var cbs = document.getElementsByName('selectedids[]');
for (var i = 0; i < cbs.length; ++i) {
if (cbs[i].checked) {
sel = true;
break;
}
}
document.getElementById('rateit_clearbutton').disabled = !sel;
}
function selectUnselectAll() {
var chk = document.getElementById('selectall').checked;
var cbs = document.getElementsByName('selectedids[]');
for (var i = 0; i < cbs.length; ++i) cbs[i].checked = chk;
enableSelectFunctions();
}
enableSelectFunctions();
</script>