Example #1
0
 function isNeedReload($activeEtap, $debateNow)
 {
     // change DB, need reload
     $debateModel = new DebateModel();
     $isNeedReload = false;
     $sessiovVars = Project::getSession();
     $idNow = $sessiovVars->getKey('idNow');
     $lastId = false;
     if ($activeEtap['name'] == 'GetTheme') {
         // ETAP 1. Get Theme from Users.
         $lastThemeId = $debateModel->getLastId('debate_theme');
         $this->returnNewThemes($lastThemeId);
         // END ETAP 1.
     } elseif ($activeEtap['name'] == 'VoteTheme') {
         // ETAP 2. Vote for Theme
         $lastVoteId = $debateModel->getLastId('debate_theme_vote');
         $this->returnVoteThemes($lastVoteId);
         // END ETAP 2.
     } elseif ($activeEtap['name'] == 'ChooseSecondUser') {
         // ETAP 3. Election for Secont USER , by auction, who pay more - get part in debate
         $stake_amount = $debateNow['stake_amount'];
         $this->returnStakeSecondUser($stake_amount);
         // END ETAP 3. Election for Secont USER , by auction
     } elseif ($activeEtap['name'] == 'ChooseHelpers') {
         // ETAP 4. Election for Helpers
         $lastHelperId = $debateModel->getLastId('debate_helper_check');
         $this->returnChooseHelpers($lastHelperId);
         // END ETAP 4. Election for Helpers
     } elseif ($activeEtap['name'] == 'GetStakes') {
         // ETAP 5. Stakes from users on Debate Users
         $lastStakeId = $debateModel->getLastId('debate_stakes');
         $this->returnDoStakePage($lastStakeId);
         // END ETAP 5. Stakes from users on Debate Users
     } elseif ($activeEtap['name'] == 'Debates') {
         // ETAP 6. DEBATE'S Chats
         // END ETAP 6. DEBATE'S Chats
     } elseif ($activeEtap['name'] == 'Results') {
         // ETAP 7. Last Etap. Results
         // END ETAP 7. Last Etap. Results
     }
     //echo $activeEtap['name']." - ".$idNow." = ".$lastId;
     if ($lastId && $idNow < $lastId) {
         $isNeedReload = true;
         $sessiovVars->add('idNow', $lastId);
     }
     return $isNeedReload;
 }