本文整理汇总了PHP中WC_Challenge::getVotesDif方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Challenge::getVotesDif方法的具体用法?PHP WC_Challenge::getVotesDif怎么用?PHP WC_Challenge::getVotesDif使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Challenge
的用法示例。
在下文中一共展示了WC_Challenge::getVotesDif方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onReset
private function onReset(WC_Challenge $chall)
{
require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
# Remove solved
$cid = $chall->getID();
$solved = GDO::table('WC_ChallSolved');
if (false === $solved->update("csolve_date='', csolve_options=0", "csolve_cid={$cid}")) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$affected = $solved->affectedRows();
$back = GWF_HTML::message('WeChall', "Reset {$affected} players that have solved it.");
# Remove from users from groups
$gid = $chall->getGID();
$usergroup = GDO::table('GWF_UserGroup');
if (false === $usergroup->deleteWhere("ug_groupid={$gid}")) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$affected = $usergroup->affectedRows();
$back .= GWF_HTML::message('WeChall', "Removed {$affected} players from the challenge group.");
# Reset votes
Module_WeChall::includeVotes();
if (false === $chall->getVotesDif()->resetVotesSameSettings()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $chall->getVotesEdu()->resetVotesSameSettings()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $chall->getVotesFun()->resetVotesSameSettings()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (false === $chall->onRecalcVotes()) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
# reset solve count and various vars
if (false === $chall->saveVars(array('chall_solvecount' => 0, 'chall_views' => 0, 'chall_date' => GWF_Time::getDate(GWF_Date::LEN_SECOND)))) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $back;
}