This page is a stub of information related to the not-very-well-documented simple wiki ratings feature.
Set "Simple wiki ratings" under Admin Home, Wiki, Features (tiki-admin.php?page=wiki&cookietab=2)
'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), ),
"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', ),
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); }
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')); }
$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}
$votings = TikiDb::get()->table('tiki_user_votings');
$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 ';
$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',
$query = 'delete from `tiki_user_votings` where `id`=?';
TikiDb::get()->query('DELETE FROM `tiki_user_votings` WHERE `id` LIKE ?', array('test.%'));
return TikiDb::get()->fetchAll('SELECT `user`, `id`, `optionId` FROM `tiki_user_votings` WHERE `id` LIKE ? ORDER BY `user`, `id`, `optionId`', array('test.%'));
$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));
$userVotings = $this->table('tiki_user_votings');
...
$this->query('update `tiki_user_votings` set `user`=? where `user`=?', array($to, $from));
$votings = TikiDb::get()->table('tiki_user_votings');
{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-
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:
templates/admin/include_rating.tpl:
templates/admin/include_rating.tpl- </div> templates/admin/include_rating.tpl- </fieldset>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-
templates/admin/include_wiki.tpl-
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:
templates/admin/include_wiki.tpl: <div class="adminoptionboxchild" id="wiki_simple_ratings_childcontainer">templates/admin/include_wiki.tpl:
templates/admin/include_wiki.tpl- </div>templates/admin/include_wiki.tpl-
templates/admin/include_wiki.tpl-
templates/admin/include_wiki.tpl-