1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8function smarty_function_rating_override_menu($params, $smarty)
9{
10	global $prefs;
11	$headerlib = TikiLib::lib('header');
12	$ratinglib = TikiLib::lib('rating');
13
14	$menu = '';
15	$options = $ratinglib->override_array($params['type'], true, true);
16	$optionsLength = count($options);
17	$backgroundsSets = $ratinglib->get_options_smiles_backgrounds($params['type']);
18
19	foreach ($options as $i => $option) {
20		if ($prefs['rating_smileys'] == 'y') {
21			$images = '';
22
23			foreach ($backgroundsSets[$i] as $i => $background) {
24				$images .= '<img src="' . $background . '"/>';
25			}
26
27			$html = count($option) . ' ' . $images;
28		} else {
29			$html = implode(',', $option);
30		}
31
32		$menu .= "<div class='deliberationConfigureItemRating ui-widget ui-state-default ui-corner-all ui-button-text-only' data-val='$i'>" . $html . "</div>";
33	}
34
35	//<select class='rating_override_selector' style='width: 250px;' name='rating_override[]'>" . $menu . "</select>";
36
37	return
38		"<div class='deliberationItemRatings' style='display:none;'>$menu</div>
39		<span class='deliberationConfigureItemRatings button' style='float:right;'><a href='#'>" . tr('Configure Ratings') . "</a></span>
40		<input class='deliberatioRatingOverrideSelector' type='hidden' name='rating_override[]' value='" . ($optionsLength) . "'/>";
41}
42