Stub
This page is a stub of information related to the not-very-well-documented simple wiki ratings feature.
Enabling and Configuration
Set "Simple wiki ratings" under Admin Home, Wiki, Features (tiki-admin.php?page=wiki&cookietab=2)
FAQ
- Where are the results displayed?
tiki-poll_results.php ? Seems to not list Simple Wiki Rating results.
tiki-old_polls.php ? Seems to not list Simple Wiki Rating results.
The results are tabulated in the database table tiki_user_votings. The site pages for which the votes are applied are in field "id" with values like "wiki2". "Wiki2" in this example, is the Rating Type, "wiki" (as opposed to "article"), and the "2" indicates the "page_id" from database table tiki_pages.
Don't know yet if there is a page to display the results. - Why doesn't the rating bar show up on pages for users with lower permissions?
Because templates/tiki-show_page.tpl requires $tiki_p_assign_perm_wiki_page eq 'y' . This appears to be a bug. Consider changing that to " $tiki_p_wiki_vote_ratings eq 'y' ". - Can the collected votes be deleted somehow to reset the tally?
From lib/prefs/wiki.php:
'wiki_simple_ratings' => array( 'name' => tra('Simple wiki ratings'), 'description' => tra('Enable users to rate articles based on a simple numeric scale.'), 'type' => 'flag', 'default' => 'n', ), 'wiki_simple_ratings_options' => array( 'name' => tra('Wiki rating options'), 'description' => tra('List of options available for the rating of wiki pages.'), 'type' => 'text', 'separator' => ',', 'filter' => 'int', 'default' => range(1, 5), ),
From tiki-admin.php:
"rating" => array( 'position' => '-300px -215px;', 'icon' => 'img/icons/large/rating.png', 'title' => tr('Rating'), 'help' => 'Advanced+Rating', 'disabled' => $prefs['wiki_simple_ratings'] !== 'y' && $prefs['rating_advanced'] !== 'y' && $prefs['article_user_rating'] !== 'y', ),
From lib/rating/ratinglib.php
References database table "tiki_user_votings".
function get_options( $type ) { $pref = 'rating_default_options'; switch( $type ) { case 'wiki page': $pref = 'wiki_simple_ratings_options'; break; case 'article': $pref = 'article_user_rating_options'; break; } global $tikilib; return $tikilib->get_preference($pref, range(1, 5), true); }
From lib/test/rating/RegisterVoteTest.php
function testGetWikiPageRange() { global $prefs; $prefs['wiki_simple_ratings_options'] = range(2, 8); $lib = new RatingLib; $this->assertEquals(range(2, 8), $lib->get_options('wiki page')); }
From templates/tiki-show_page.tpl
$tiki_p_assign_perm_wiki_page appears to be a bug. Too strong. Should perhaps be $tiki_p_wiki_vote_ratings .
{if $prefs.feature_wiki_ratings eq 'y'} {include file='poll.tpl'} {/if} {if $prefs.wiki_simple_ratings eq 'y' && $tiki_p_assign_perm_wiki_page eq 'y'} <form method="post" action=""> {rating type="wiki page" id=$page_id} </form> {/if}
From lib/core/Tracker/Field/Rating.php:
$votings = TikiDb::get()->table('tiki_user_votings');
From lib/polls/polllib_shared.php:
$query = "select user from `tiki_user_votings` where `optionId`=?";
' left join `tiki_user_votings` tuv on (tpo.`optionId` = tuv.`optionId`)' .
$query = 'delete from `tiki_user_votings` where `id`=?';
$query = 'delete from `tiki_user_votings` where `id`=? and `optionId`=? and ';
From lib/rating/ratinglib.php:
$joins = array( '`tiki_user_votings` `uv`' );
INNER JOIN ( SELECT ' . $connect . '(`time`) `t`, `user` `u` FROM `tiki_user_votings` WHERE ' . implode(' AND ', $where) . ' GROUP BY `user` ' . $extra . ' ) `j`
'INSERT INTO `tiki_user_votings` ( `user`, `ip`, `id`, `optionId`, `time` ) VALUES( ?, ?, ?, ?, ? )',
'SELECT `optionId` FROM `tiki_user_votings` WHERE `user` = ? AND `id` = ? ORDER BY `time` DESC',
From lib/surveys/surveylib.php:
$query = 'delete from `tiki_user_votings` where `id`=?';
lib/test/rating/AggregationTest.php:
TikiDb::get()->query('DELETE FROM `tiki_user_votings` WHERE `id` LIKE ?', array('test.%'));
Fromlib/test/rating/RegisterVoteTest.php:
return TikiDb::get()->fetchAll('SELECT `user`, `id`, `optionId` FROM `tiki_user_votings` WHERE `id` LIKE ? ORDER BY `user`, `id`, `optionId`', array('test.%'));
lib/tikilib.php:
$query = "select count(*) from `tiki_user_votings` where `user`=? and `id`=?";
$userVotings = $this->table('tiki_user_votings');
$vote = $this->getOne("select `optionId` from `tiki_user_votings` where `user` = ? and `id` = ? order by `time` desc", array( $user, $id));
lib/trackers/trackerlib.php:
$userVotings = $this->table('tiki_user_votings');
...
lib/userslib.php:
$this->query('update `tiki_user_votings` set `user`=? where `user`=?', array($to, $from));
lib/wiki-plugins/wikiplugin_votings.php:
$votings = TikiDb::get()->table('tiki_user_votings');
From other pages
{CODE(wrap="0")}$ grep -C5 -iR "wiki_simple_ratings" * | grep -v -e templates_c -e temp\/cache #redacted out the above
templates/admin/include_rating.tpl-Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
templates/admin/include_rating.tpl-
templates/admin/include_rating.tpl- <fieldset>templates/admin/include_rating.tpl- <legend>Wiki{/tr}</legend>
templates/admin/include_rating.tpl:Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
templates/admin/include_rating.tpl-
templates/admin/include_rating.tpl- <fieldset>templates/admin/include_rating.tpl- <legend>Articles{/tr}</legend>
--
templates/admin/include_wiki.tpl-
Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
templates/admin/include_wiki.tpl- <a class="link" href="tiki-objectpermissions.php?permType=wiki&textFilter=ratings&show_disabled_features=y" title="Permission{/tr}"></a>
templates/admin/include_wiki.tpl- </div> templates/admin/include_wiki.tpl:Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
templates/admin/include_wiki.tpl-
templates/admin/include_wiki.tpl-Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments
Plugin execution pending approval
This plugin was recently added or modified. Until an editor of the site validates the parameters, execution will not be possible. You are allowed to:
- View arguments