Exemple #1
0
if (count($boxes) > 0) {
    echo WC_HTML::button('btn_warboxes', $site->hrefWarboxes());
}
echo WC_HTML::button('btn_ranking', $site->hrefRanking(true));
echo WC_HTML::button('btn_site_history', $site->hrefHistory());
echo '</div></div>' . PHP_EOL;
?>

<?php 
if (false === ($user = GWF_User::getByName(Common::getGet('username', '')))) {
}
if ($user !== false) {
    $userid = $user->getID();
    if (false !== ($regat = WC_RegAt::getRegatRow($userid, $siteid))) {
        $max = $site->getOnsiteScore();
        echo GWF_Box::box($tLang->lang('site_detail_uinfo', array($user->displayUsername(), $regat->getOnsiteScore(), $max, $site->displayName(), round($regat->getPercent($max), 2), WC_RegAt::calcExactSiteRank($user, $siteid), $site->calcScore($regat))));
    }
}
?>

<div class="ib"><?php 
echo GWF_Box::box(GWF_Message::display($tVars['descr']));
?>
</div>

<table>
	<thead>
		<tr>
			<th colspan="2" id="wc_site_detail_head"><?php 
echo $site->displayLogo(32, $tLang->lang('hover_logo', array($site->displayName()))) . $site->displayLink();
?>
Exemple #2
0
 /**
  * Wechall internally bot response.
  * The advantage over the other method is accurate challcount.
  * @param string $input
  * @return string
  */
 public function wechallChalls($input)
 {
     if ($input === '') {
         return sprintf('Try wechallchalls.php?userame=blub');
     }
     require_once GWF_CORE_PATH . 'module/WeChall/WC_ChallSolved.php';
     $wechall = WC_Site::getWeChall();
     $siteid = $wechall->getID();
     if (false !== ($user = GWF_User::getByName($input))) {
         if ($user->isOptionEnabled(0x10000000)) {
             die('This user is not ranked!');
         }
         $rank = WC_RegAt::calcExactSiteRank($user, $siteid);
     } elseif (false !== ($user = WC_RegAt::getUserBySiteRank($siteid, $input))) {
         $rank = intval($input);
     } else {
         return sprintf('The user does not exist.');
     }
     //		if (false !== ($error = $this->module->isExcludedFromAPI($user))) {
     //			return $error;
     //		}
     $userid = $user->getID();
     $username = $user->displayUsername();
     $solvedCount = WC_ChallSolved::getSolvedCount($userid);
     $score = WC_Challenge::getScoreForUser($user);
     $challcount = WC_Challenge::getChallCount();
     $maxScore = WC_Challenge::getMaxScore();
     $percent = $score / $maxScore * 100;
     $out = sprintf('%s solved %d of %d Challenges with %d of %d possible points (%.02f%%).', $username, $solvedCount, $challcount, $score, $maxScore, $percent);
     if ($rank !== false) {
         $out .= sprintf(' Rank for the site WeChall: %d', $rank);
     }
     return $out;
 }