示例#1
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $onsitescore, $comment)
 {
     $user = GWF_User::getByID($user->getID());
     $max = $site->getOnsiteScore();
     $perc = $max <= 0 ? 0 : round($onsitescore / $max * 10000);
     $entry = new self(array('userhist_uid' => $user->getVar('user_id'), 'userhist_date' => time(), 'userhist_sid' => $site->getVar('site_id'), 'userhist_percent' => $perc, 'userhist_onsitescore' => $onsitescore, 'userhist_rank' => WC_RegAt::calcRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_comment' => $comment));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
示例#2
0
 public static function insertEntry(GWF_User $user, WC_Site $site, $type, $onsitescore_new = 0, $onsitescore_old = 0, $scoregain = 0, $onsiterank = 0)
 {
     $uid = $user->getID();
     $user = GWF_User::getByID($uid);
     $max = $site->getOnsiteScore();
     $perc_new = $max <= 0 ? 0 : round($onsitescore_new / $max * 10000);
     $perc_old = $max <= 0 ? 0 : round($onsitescore_old / $max * 10000);
     $perc_gain = $perc_new - $perc_old;
     $options = 0;
     $data = $user->getUserData();
     if (isset($data['WC_NO_XSS'])) {
         $options |= self::NO_XSS;
     }
     $entry = new self(array('userhist_uid' => $uid, 'userhist_date' => time(), 'userhist_sid' => $site->getID(), 'userhist_percent' => $perc_new, 'userhist_onsitescore' => $onsitescore_new, 'userhist_rank' => WC_RegAt::calcExactRank($user), 'userhist_totalscore' => $user->getVar('user_level'), 'userhist_gain_perc' => $perc_gain, 'userhist_gain_score' => $scoregain, 'userhist_type' => $type, 'userhist_onsiterank' => $onsiterank, 'userhist_options' => $options));
     if (WECHALL_DEBUG_SCORING) {
         echo WC_HTML::message('Inserting User History entry...');
     }
     return $entry->insert();
 }
示例#3
0
 foreach ($tVars['linked'] as $data) {
     $site instanceof WC_Site;
     $site->setVars($data);
     $regat->setVars($data);
     $siteid = $site->getVar('site_id');
     //		$regat = WC_RegAt::getRegatRow($userid, $siteid);
     $btn_update = sprintf('<input type="submit" name="update[%s]" value="%s" />', $siteid, $tLang->lang('btn_update'));
     echo GWF_Table::rowStart();
     echo GWF_Table::column($site->displayStatus());
     echo GWF_Table::column($site->displayIcon(1.0) . '&nbsp;' . $site->displayLink());
     echo GWF_Table::column($regat->getVar('regat_challsolved'), 'gwf_num');
     echo GWF_Table::column($site->getVar('site_challcount'), 'gwf_num');
     echo GWF_Table::column($site->displayAutoUpdate());
     echo GWF_Table::column($btn_update);
     echo GWF_Table::column($regat->getVar('regat_score'), 'gwf_num');
     $perc = $regat->getPercent($site->getOnsiteScore());
     $color = WC_HTML::getColorForPercent($perc);
     echo GWF_Table::column(sprintf('<span style="color: #%s">%.02f%%</span>', $color, $perc), 'gwf_num');
     echo GWF_Table::column($regat->displayLastDate(), 'gwf_date');
     echo GWF_Table::column($regat->displayOnsiteName());
     if ($regat->isOnsitenameHidden()) {
         echo GWF_Table::column(sprintf('<input type="submit" name="showname[%s]" value="%s" />', $siteid, $txtshow));
     } else {
         echo GWF_Table::column(sprintf('<input type="submit" name="hidename[%s]" value="%s" />', $siteid, $txthide));
     }
     //		if ($regat->isScored()) {
     //			echo GWF_Table::column(sprintf('<input type="submit" name="scored[%s]" value="%s" />', $siteid, $txtscore));
     //		} else {
     //			echo GWF_Table::column(sprintf('<input type="submit" name="unscored[%s]" value="%s" />', $siteid, $txtunscore));
     //		}
     echo sprintf('<td><input type="submit" name="unlink[%s]" value="%s" /></td>', $siteid, $tLang->lang('btn_unlink'));
示例#4
0
 public static function fixPercent(WC_Site $site)
 {
     return true;
     $siteid = $site->getID();
     $maxscore = $site->getOnsiteScore();
     if (false === GDO::table(__CLASS__)->update("regat_solved=regat_onsitescore/{$maxscore} WHERE regat_sid={$siteid}")) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return false;
     }
     return true;
 }