Hi folks,
Here is a method to allow ditto to sort documents using star rating values
We are going to create a new widget to manage the output value.
Open the file /manager/actions/mutate_tmplvars.dynamic.php
add line 114:
widgetParams['star_rating'] = '&mode=Mode;list;most_rated,most_voted';
and line 353
<option value="star_rating" <?php echo ($content['display']=='star_rating')? "selected='selected'":""; ?>>Star Rating</option>
Now open the file /manager/includes/tmplvars.format.inc.php
add around line 305
case 'star_rating':
$a = explode(":",$value);
$operation = $params['mode'];
switch($operation){
case 'most_rated':
$calcul = ($a[1] > 0) ? $a[0] / $a[1] : $value;
$result = round($calcul,1);
break;
case 'most_voted':
$result = (isset($a[1])) ? $a[1] : $value;
break;
}
$o = $result;
break;
Now you will have a new widget which will allow you to use the star rating value to sort with ditto
You even have the choice beetwen most rated and most voted.
Hope that helps
:-)