Beispiel #1
0
 private function getData()
 {
     $table = GDO::table('WC_Warflags');
     $by = Common::getGetString('by', 'wf_order');
     $dir = Common::getGetString('dir', 'ASC');
     $orderby = $table->getMultiOrderby($by, $dir);
     return WC_Warflag::getForBoxAndUser($this->box, GWF_User::getStaticOrGuest(), $orderby);
 }
Beispiel #2
0
 private function onSolved(WC_Warflag $flag)
 {
     if ($this->box->isMultisolve()) {
         if (false !== ($err = $this->onMultiSolved($flag))) {
             return $err;
         }
     } else {
         if (false !== ($err = $this->onSingleSolved($flag))) {
             return $err;
         }
     }
     if (!$this->box->recalcPlayersAndScore()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (false === ($this->flags = WC_Warflag::getForBoxAndUser($this->box, $this->user, 'wf_order ASC'))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $this->module->includeClass('WC_RegAt');
     if ($this->site->isUserLinked($this->user->getID())) {
         $result = $this->site->onUpdateUser($this->user);
         return $result->display($this->site->displayName());
     } else {
         return '_YOU_ARE_NOT_LINKED_TO_THE_SITE,_BUT_WELL_DONE!';
     }
 }
Beispiel #3
0
 public function parseFlagStats(GWF_User $user, &$stats)
 {
     $flags = WC_Warflag::getForBoxAndUser($this, $user);
     $ssh = 0;
     $flg = 0;
     if (count($flags) > 0) {
         $score = 0;
         $challs = 0;
         $maxscore = 0;
         foreach ($flags as $flag) {
             $flag instanceof WC_Warflag;
             if ($flag->getVar('wf_solved_at') !== NULL) {
                 $score += $flag->getVar('wf_score');
                 $challs++;
             }
             if ($flag->isWarflag()) {
                 $flg++;
             } else {
                 $ssh++;
             }
             $maxscore += $flag->getVar('wf_score');
         }
         # Remember challcount
         $this->saveVars(array('wb_challs' => count($flags), 'wb_levels' => $ssh, 'wb_flags' => $flg));
         # Save usercount?
         $site = $this->getSite();
         if ($site->isNoV1()) {
             $site->saveVar('site_usercount', WC_Warflags::getPlayercountForSite($site));
         }
         // score, rank, challssolved, maxscore, usercount, challcount
         $stats[0] += $score;
         // 			$stats[1]; RANK
         $stats[2] += $challs;
         $stats[3] += $maxscore;
         // 			$stats[4]; USERCOUNT
         $stats[5] += count($flags);
     }
 }