Exemple #1
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer);
         foreach ($this->players as $player) {
             if ($player->getIsAlive()) {
                 if ($player['id'] == $this->actualPlayer['id']) {
                     $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                     if ($this->actualPlayer->getIsBelleStar($this->game)) {
                         $notices = $this->actualPlayer->getNoticeList();
                         $notices['character_used'] = 1;
                         $this->actualPlayer->setNoticeList($notices);
                     }
                     $this->actualPlayer->save();
                 } else {
                     if ($player['id'] == $nextPositionPlayer['id']) {
                         $player['phase'] = Player::PHASE_UNDER_ATTACK;
                     }
                     MySmarty::assign('card', $this->cards[0]);
                     $response = MySmarty::fetch($this->template);
                     $player['command_response'] = $response;
                     $player->save();
                 }
             }
         }
         $this->game['inter_turn_reason'] = serialize(array('action' => 'gatling', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id']));
         $this->game['inter_turn'] = $nextPositionPlayer['id'];
         $this->game->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #2
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $this->attackingCards = $this->cards;
         $nextPositionPlayer = $this->findNextPlayerWithHandCards($this->game, $this->actualPlayer, $this->actualPlayer);
         if ($nextPositionPlayer['id'] != $this->actualPlayer['id']) {
             foreach ($this->players as $player) {
                 if ($player->getIsAlive()) {
                     if ($player['id'] == $this->actualPlayer['id']) {
                         $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                         $this->actualPlayer->save();
                     } else {
                         if ($player['id'] == $nextPositionPlayer['id']) {
                             $player['phase'] = Player::PHASE_UNDER_ATTACK;
                         }
                         MySmarty::assign('card', $this->cards[0]);
                         $response = MySmarty::fetch($this->template);
                         $player['command_response'] = $response;
                         $player->save();
                     }
                 }
             }
             $this->game['inter_turn_reason'] = serialize(array('action' => 'poker', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id'], 'thrownCards' => array()));
             $this->game['inter_turn'] = $nextPositionPlayer['id'];
             $this->game->save();
         } else {
             // bola by blbost hrat kartu poker ak nikto iny nema karty na ruke
         }
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #3
0
 public function getContent()
 {
     if (LoggedUser::whoIsLogged()) {
         if (isset($_COOKIE['ref_url'])) {
             $url = $_COOKIE['ref_url'];
             $absolute = FALSE;
         } else {
             $page = PageActionMap::getPageByTypeAndLanguage('rooms');
             $url = PageActionMap::createUrl($page['alias']);
             $absolute = TRUE;
         }
         Utils::redirect($url, $absolute);
     }
     if (Utils::post('login')) {
         MySmarty::assign('username', Utils::post('username'));
         $validation = LoggedUser::userLogin();
         //var_Dump($validation);exit();
         if ($validation === TRUE) {
             Utils::redirect(Utils::getActualUrlWithoutGetParameters(), FALSE);
         } else {
             MySmarty::assign('errors', $validation);
         }
     }
     return MySmarty::fetch('login.tpl');
 }
Exemple #4
0
 protected function run()
 {
     if ($this->check == self::OK) {
         // TODO moze sa stat ze hraju uz len dvaja apache kid a utocnik - asi staci ak skontrolujeme ci next pos player != od actual
         $this->attackingCards = $this->cards;
         $nextPositionPlayer = $this->getNextPositionPlayer($this->game, $this->actualPlayer);
         foreach ($this->players as $player) {
             if ($player->getIsAlive()) {
                 if ($player['id'] == $this->actualPlayer['id']) {
                     $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                     $this->actualPlayer->save();
                 } else {
                     if ($player['id'] == $nextPositionPlayer['id']) {
                         $player['phase'] = Player::PHASE_UNDER_ATTACK;
                     }
                     MySmarty::assign('card', $this->cards[0]);
                     $response = MySmarty::fetch($this->template);
                     $player['command_response'] = $response;
                     $player->save();
                 }
             }
         }
         $this->game['inter_turn_reason'] = serialize(array('action' => 'wild_band', 'from' => $this->actualPlayer['id'], 'to' => $nextPositionPlayer['id'], 'cards' => $this->getCardIds()));
         $this->game['inter_turn'] = $nextPositionPlayer['id'];
         $this->game->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     }
 }
Exemple #5
0
 public function main()
 {
     $room = intval($_POST['room']);
     $game = intval($_POST['game']);
     $loggedUser = LoggedUser::whoIsLogged();
     $lastActivity = Room::getUserLastActivityInRoom($loggedUser['id'], $room);
     Room::updateUserLastActivity($loggedUser['id'], $room);
     MySmarty::assign('messages', Chat::getMessages($room, $loggedUser['id'], 0, $game));
     echo MySmarty::fetch('message-box.tpl');
 }
Exemple #6
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         // TODO prerobit tak aby to fungovalo aj bez javascriptu, onclick treba nahradit niecim inym, pripadne doplnit tlacitko ktore skryje ten overlay
         MySmarty::assign('card', $this->cards[0]);
         $response = MySmarty::fetch($this->template);
         $this->attackedPlayer['command_response'] = $response;
         $this->attackedPlayer->save();
     }
     return '';
 }
Exemple #7
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         $actualPlayerResponse = '';
         foreach ($this->game->getAdditionalField('players') as $player) {
             $possibleChoices = unserialize($player['possible_choices']);
             $characterRepository = new CharacterRepository();
             $possibleCharacters = $characterRepository->getById($possibleChoices['possible_characters']);
             MySmarty::assign('possibleCharacters', $possibleCharacters);
             MySmarty::assign('player', $player);
             $response = MySmarty::fetch($this->template);
             $player['command_response'] = $response;
             $player->save();
             if ($player['id'] == $this->actualPlayer['id']) {
                 $actualPlayerResponse = $response;
             }
         }
         return $actualPlayerResponse;
     } else {
         return '';
     }
 }
Exemple #8
0
 public function render()
 {
     $this->addSeo();
     $this->setup();
     return MySmarty::fetch($this->template);
 }
Exemple #9
0
 protected function createResponse()
 {
     if ($this->check == self::OK) {
         if ($this->params['playCardName'] == 'jail') {
         } elseif ($this->params['playCardName'] == 'dynamite') {
         } elseif ($this->params['playCardName'] == 'barrel') {
         } else {
             if ($this->actualPlayer['possible_choices']) {
                 $possibleChoices = unserialize($this->actualPlayer['possible_choices']);
                 $cardRepository = new CardRepository();
                 $possibleCards = array();
                 foreach ($possibleChoices['drawn_cards'] as $cardId) {
                     $possibleCards[] = $cardRepository->getOneById($cardId);
                 }
                 MySmarty::assign('possiblePickCount', $possibleChoices['possible_pick_count']);
                 MySmarty::assign('possibleCards', $possibleCards);
                 MySmarty::assign('possibleCardsCount', count($possibleCards));
                 MySmarty::assign('game', $this->game);
                 $response = MySmarty::fetch($this->template);
                 $this->actualPlayer['command_response'] = $response;
                 $this->actualPlayer->save();
                 return $response;
             }
         }
     }
 }
Exemple #10
0
 protected function run()
 {
     if ($this->check == self::OK) {
         $place = $this->params['place'];
         if (!$place) {
             $place = 'hand';
         }
         // aj Vera Custer moze hrat za Garyho Lootera
         $garyLooters = array();
         foreach ($this->getPlayers() as $player) {
             // pozrieme sa na vsetkych hracov ktori este nie su mrtvi a ani nie su aktualny hrac
             if ($player['actual_lifes'] > 0 && $this->actualPlayer['id'] != $player['id']) {
                 if ($player->getIsGaryLooter($this->game)) {
                     $garyLooters[] = $player;
                 }
             }
         }
         if ($place == 'hand' && $garyLooters) {
             // vymysliet ako davat Garymu a Vere karty na striedacku - zatial spravene len pre nahodne vybraneho Garyho
             $garyLooter = $garyLooters[array_rand($garyLooters)];
             GameUtils::moveCards($this->game, $this->cards, $this->actualPlayer, 'hand', $garyLooter, 'hand');
         } else {
             GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place);
         }
         if ($place == 'table') {
             // kedze je mozne ze rusime nejaku modru kartu ktora ovplyvnuje vzdialenost, preratame maticu
             // ak to bude velmi pomale, budeme to robit len ak je medzi vyhodenymi kartami fakt takato karta
             $matrix = GameUtils::countMatrix($this->game);
             $this->game['distance_matrix'] = serialize($matrix);
             $this->game->save();
         }
         if (in_array($this->interTurnReason['action'], array('wild_band'))) {
             $this->runMollyStarkAction();
             $this->changeInterturn();
         }
     } elseif ($this->check == self::OK_JOSE_DELGADO) {
         $place = 'hand';
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards, $place);
         $drawnCards = GameUtils::drawCards($this->game, 2);
         $handCards = unserialize($this->actualPlayer['hand_cards']);
         $handCards = array_merge($handCards, $drawnCards);
         $this->actualPlayer['hand_cards'] = serialize($handCards);
         $notices = $this->actualPlayer->getNoticeList();
         if (isset($notices['character_used'])) {
             $notices['character_used'] = $notices['character_used'] + 1;
         } else {
             $notices['character_used'] = 1;
         }
         $this->actualPlayer->setNoticeList($notices);
         // zistit ci sa tu nahodou nestane to ze hracovi ostanu karty v ruke a este mu pribudnu dalsie
         $this->actualPlayer->save();
     } elseif ($this->check == self::OK_DOC_HOLYDAY) {
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
         MySmarty::assign('card', $this->cards[0]);
         // TODO mozno sem poslat nejake veci ze zautocil doc holyday svojim charakterom
         $response = MySmarty::fetch($this->template);
         $this->attackedPlayer['command_response'] = $response;
         $this->attackedPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
         $this->attackedPlayer->save();
         $notices = $this->actualPlayer->getNoticeList();
         $notices['character_used'] = 1;
         $this->actualPlayer->setNoticeList($notices);
         $this->actualPlayer['phase'] = Player::PHASE_WAITING;
         $this->actualPlayer->save();
         $this->game['inter_turn'] = $this->attackedPlayer['id'];
         $this->game['inter_turn_reason'] = serialize(array('action' => 'doc_holyday', 'from' => $this->actualPlayer['id'], 'to' => $this->attackedPlayer['id']));
         $this->game->save();
     } elseif ($this->check == self::OK_SID_KETCHUM) {
         $additionalLifes = 1;
         $newLifes = min($this->actualPlayer['actual_lifes'] + $additionalLifes, $this->actualPlayer['max_lifes']);
         $this->actualPlayer['actual_lifes'] = $newLifes;
         $this->actualPlayer->save();
         GameUtils::throwCards($this->game, $this->actualPlayer, $this->cards);
     } elseif ($this->check == self::OK_POKER) {
         // odlozime karty
         $handCards = unserialize($this->actualPlayer['hand_cards']);
         $newHandCards = array();
         $selectedCard = $this->cards[0];
         foreach ($handCards as $handCard) {
             if ($handCard != $selectedCard['id']) {
                 $newHandCards[] = $handCard;
             }
         }
         $this->actualPlayer['hand_cards'] = serialize($newHandCards);
         $this->actualPlayer->save();
         $this->interTurnReason['thrownCards'][] = $selectedCard['id'];
         $this->changeInterturn();
     }
 }
 protected function run()
 {
     if ($this->check == self::OK) {
         $possibleChoices = unserialize($this->actualPlayer['possible_choices']);
         $possibleCards = $possibleChoices['drawn_cards'];
         $restAction = $possibleChoices['rest_action'];
         $handCards = unserialize($this->actualPlayer['hand_cards']);
         $drawPile = unserialize($this->game['draw_pile']);
         $throwPile = unserialize($this->game['throw_pile']);
         $nextPlayerPossibleCards = array();
         foreach ($possibleCards as $possibleCard) {
             if (in_array($possibleCard, $this->params['selectedCards'])) {
                 $handCards[] = $possibleCard;
             } else {
                 if ($restAction == 'back_to_deck') {
                     $drawPile[] = $possibleCard;
                 } elseif ($restAction == 'general_store') {
                     $nextPlayerPossibleCards[] = $possibleCard;
                 } elseif ($restAction == 'throw') {
                     $throwPile[] = $possibleCard;
                 }
             }
         }
         if ($this->interTurnReason['action'] == 'general_store') {
             $nextPositionPlayer = GameUtils::getPlayerOnNextPosition($this->game, $this->actualPlayer);
             if ($nextPositionPlayer['id'] == $this->attackingPlayer['id']) {
                 $this->game['inter_turn_reason'] = '';
                 $this->game['inter_turn'] = 0;
                 $this->attackingPlayer['phase'] = Player::PHASE_PLAY;
                 $this->attackingPlayer->save();
             } else {
                 if ($this->actualPlayer['id'] == $this->attackingPlayer['id']) {
                     $this->actualPlayer['phase'] = Player::PHASE_WAITING;
                 } else {
                     $this->actualPlayer['phase'] = Player::PHASE_NONE;
                 }
                 $this->game['inter_turn'] = $nextPositionPlayer['id'];
                 $cardRepository = new CardRepository();
                 $possibleCards = array();
                 foreach ($nextPlayerPossibleCards as $cardId) {
                     $possibleCards[] = $cardRepository->getOneById($cardId);
                 }
                 MySmarty::assign('possiblePickCount', 1);
                 MySmarty::assign('possibleCards', $possibleCards);
                 MySmarty::assign('possibleCardsCount', count($possibleCards));
                 MySmarty::assign('game', $this->game);
                 $response = MySmarty::fetch($this->template);
                 $playerPossibleChoices = array('drawn_cards' => $nextPlayerPossibleCards, 'possible_pick_count' => 1, 'rest_action' => 'general_store');
                 $nextPositionPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
                 $nextPositionPlayer['possible_choices'] = serialize($playerPossibleChoices);
                 $nextPositionPlayer['command_response'] = $response;
                 $nextPositionPlayer->save();
             }
         } else {
             $this->actualPlayer['phase'] = Player::PHASE_PLAY;
         }
         $this->actualPlayer['hand_cards'] = serialize($handCards);
         $this->actualPlayer['command_response'] = '';
         $this->actualPlayer['possible_choices'] = '';
         $this->actualPlayer = $this->actualPlayer->save(TRUE);
         $this->game['draw_pile'] = serialize($drawPile);
         $this->game['throw_pile'] = serialize($throwPile);
         $this->game = $this->game->save(TRUE);
     }
 }
    $budgets = Budget::getOptions(array("USER_ID" => $user->getId(), "ACTIVE" => 1));
    $spent = array();
    $budgetLeft = array();
    foreach ($budgets as $key => $item) {
        $activities = Activity::getOptions(array("USER_ID" => $user->getId(), "CATEGORY_ID" => $item['category_id'], "TRANSACTION_DATE_START" => Date::firstOfMonth()));
        $value = 0;
        foreach ($activities as $activityKey => $activityItem) {
            $value += $activityItem['amount'];
        }
        $spent[$key] = 0 - $value;
        $budgetLeft[$key] = $item['amount'] + $value;
    }
    $smarty->assign('spent', $spent);
    $smarty->assign('budgets', $budgets);
    $smarty->assign('budgetLeft', $budgetLeft);
    if ($fullPage) {
        $userCategories = Category::getOptions(array("USER_ID" => $user->getId(), "ACTIVE" => 1));
        $allCategories = Category::getOptions(array("ACTIVE" => 1));
        $smarty->assign('allCategories', $allCategories);
        $smarty->assign('userCategories', $userCategories);
        $smarty->assign('user', $user);
        $smarty->assign('left_menu', true);
        $smarty->display('budget.tpl');
    } else {
        echo $smarty->fetch('budget_table.tpl');
    }
} catch (AccessDeniedException $e) {
    trigger_error('Access Denied');
} catch (Exception $e) {
    trigger_error('An error has occurred, please try again in a few minutes');
}
Exemple #13
0
 protected function changeInterturn()
 {
     $attackingPlayerNotices = $this->attackingPlayer->getNoticeList();
     if ($this->attackingPlayer->getIsSlabTheKiller($this->game) && $attackingPlayerNotices['character_used'] && in_array($this->interTurnReason['action'], array('bang')) && $this->commandName != 'life') {
         // zrusime slab the killerovi prvu ranu, dalsie vedla by uz malo ist do else vetvy
         if (isset($attackingPlayerNotices['character_used'])) {
             unset($attackingPlayerNotices['character_used']);
         }
         $this->attackingPlayer->setNoticeList($attackingPlayerNotices);
         $this->attackingPlayer->save();
     } else {
         if (in_array($this->interTurnReason['action'], array('indians', 'gatling', 'howitzer', 'wild_band'))) {
             $nextPositionPlayer = $this->getNextPositionPlayer($this->game, $this->actualPlayer);
             // ak je hrac na nasledujucej pozicii ten ktory utocil, ukoncime inter turn
             if ($nextPositionPlayer['id'] == $this->attackingPlayer['id']) {
                 $this->game['inter_turn_reason'] = '';
                 $this->game['inter_turn'] = 0;
                 if ($this->attackingPlayer->getIsBelleStar($this->game)) {
                     $attackingPlayerNotices = $this->attackingPlayer->getNoticeList();
                     if (isset($attackingPlayerNotices['character_used'])) {
                         unset($attackingPlayerNotices['character_used']);
                     }
                     $this->attackingPlayer->setNoticeList($attackingPlayerNotices);
                 }
                 $this->attackingPlayer['phase'] = Player::PHASE_PLAY;
                 $this->attackingPlayer->save();
             } else {
                 // inak nastavime pokracovanie interturnu
                 $nextPositionPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
                 $nextPositionPlayer->save();
                 $this->game['inter_turn_reason'] = serialize(array('action' => $this->interTurnReason['action'], 'from' => $this->attackingPlayer['id'], 'to' => $nextPositionPlayer['id'], 'cards' => $this->interTurnReason['cards']));
                 $this->game['inter_turn'] = $nextPositionPlayer['id'];
             }
         } elseif (in_array($this->interTurnReason['action'], array('fanning'))) {
             if (isset($this->interTurnReason['additionalTo'])) {
                 $playerRepository = new PlayerRepository();
                 $nextPlayer = $playerRepository->getOneById($this->interTurnReason['additionalTo']);
                 $nextPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
                 $nextPlayer->save();
                 $this->game['inter_turn_reason'] = serialize(array('action' => $this->interTurnReason['action'], 'from' => $this->attackingPlayer['id'], 'to' => $this->interTurnReason['additionalTo'], 'cards' => $this->interTurnReason['cards']));
                 $this->game['inter_turn'] = $this->interTurnReason['additionalTo'];
             } else {
                 // ukoncime interturn
                 $this->game['inter_turn_reason'] = '';
                 $this->game['inter_turn'] = 0;
                 if ($this->attackingPlayer->getIsBelleStar($this->game) || $this->attackingPlayer->getIsSlabTheKiller($this->game)) {
                     $attackingPlayerNotices = $this->attackingPlayer->getNoticeList();
                     if (isset($attackingPlayerNotices['character_used'])) {
                         unset($attackingPlayerNotices['character_used']);
                     }
                     $this->attackingPlayer->setNoticeList($attackingPlayerNotices);
                 }
                 $this->attackingPlayer['phase'] = Player::PHASE_PLAY;
                 $this->attackingPlayer->save();
             }
         } elseif (in_array($this->interTurnReason['action'], array('poker'))) {
             $nextPositionPlayer = $this->findNextPlayerWithHandCards($this->game, $this->actualPlayer, $this->attackingPlayer);
             // ak je hrac na nasledujucej pozicii ten ktory utocil, ukoncime inter turn
             if ($nextPositionPlayer['id'] == $this->attackingPlayer['id']) {
                 $this->game['inter_turn_reason'] = '';
                 $this->game['inter_turn'] = 0;
                 $cardRepository = new CardRepository();
                 $possibleCards = array();
                 $containAce = FALSE;
                 foreach ($this->interTurnReason['thrownCards'] as $cardId) {
                     $possibleCard = $cardRepository->getOneById($cardId);
                     if ($possibleCard['value'] == 'A') {
                         $containAce = TRUE;
                     }
                     $possibleCards[] = $possibleCard;
                 }
                 if ($containAce === TRUE) {
                     // ak je vyhodene aspon jedno eso
                     $this->attackingPlayer['phase'] = Player::PHASE_PLAY;
                     // odhodime vsetky karty, ktore hraci vylozili
                     $throwPile = unserialize($this->game['throw_pile']);
                     foreach ($this->interTurnReason['thrownCards'] as $cardId) {
                         $throwPile[] = $cardId;
                     }
                     $this->game['throw_pile'] = serialize($throwPile);
                 } else {
                     // inak vybera 2 karty z vyhoenych
                     MySmarty::assign('possiblePickCount', 2);
                     MySmarty::assign('possibleCards', $possibleCards);
                     MySmarty::assign('possibleCardsCount', count($possibleCards));
                     MySmarty::assign('game', $this->game);
                     $response = MySmarty::fetch('cards-choice.tpl');
                     $playerPossibleChoices = array('drawn_cards' => $this->interTurnReason['thrownCards'], 'possible_pick_count' => 2, 'rest_action' => 'throw');
                     $this->attackingPlayer['phase'] = Player::PHASE_POKER_SELECT;
                     $this->attackingPlayer['possible_choices'] = serialize($playerPossibleChoices);
                     $this->attackingPlayer['command_response'] = $response;
                 }
                 $this->attackingPlayer->save();
             } else {
                 // inak nastavime pokracovanie interturnu
                 $nextPositionPlayer['phase'] = Player::PHASE_UNDER_ATTACK;
                 $nextPositionPlayer->save();
                 $this->game['inter_turn_reason'] = serialize(array('action' => $this->interTurnReason['action'], 'from' => $this->attackingPlayer['id'], 'to' => $nextPositionPlayer['id'], 'thrownCards' => $this->interTurnReason['thrownCards']));
                 $this->game['inter_turn'] = $nextPositionPlayer['id'];
             }
         } else {
             // ukoncime interturn
             $this->game['inter_turn_reason'] = '';
             $this->game['inter_turn'] = 0;
             if ($this->attackingPlayer->getIsBelleStar($this->game) || $this->attackingPlayer->getIsSlabTheKiller($this->game)) {
                 $attackingPlayerNotices = $this->attackingPlayer->getNoticeList();
                 if (isset($attackingPlayerNotices['character_used'])) {
                     unset($attackingPlayerNotices['character_used']);
                 }
                 $this->attackingPlayer->setNoticeList($attackingPlayerNotices);
             }
             $this->attackingPlayer['phase'] = Player::PHASE_PLAY;
             $this->attackingPlayer->save();
         }
         // premazeme notices
         $notices = $this->actualPlayer->getNoticeList();
         if (isset($notices['barrel_used'])) {
             unset($notices['barrel_used']);
         }
         if (isset($notices['character_jourdonnais_used'])) {
             unset($notices['character_jourdonnais_used']);
         }
         if (isset($notices['character_used'])) {
             unset($notices['character_used']);
         }
         $this->actualPlayer->setNoticeList($notices);
         // aktualnemu hracovi nastavime fazu na none a response na nic vzdy
         if ($this->actualPlayer['id'] == $this->interTurnReason['to']) {
             $this->actualPlayer['phase'] = Player::PHASE_NONE;
         } elseif ($this->actualPlayer['id'] == $this->interTurnReason['from']) {
             $this->actualPlayer['phase'] = Player::PHASE_PLAY;
         } else {
             throw new Exception('Moze byt aktualny hrac niekto iny?', 1353360969);
         }
         $this->actualPlayer['command_response'] = '';
     }
     $this->actualPlayer->save();
     $this->game->save();
 }
Exemple #14
0
        Utils::redirect($url);
    }
    $actionClass = new $actionClassName();
    MySmarty::assign('content', $actionClass->getContent());
} catch (Exception $e) {
    // TODO vsetky exceptions lokalizovat a hadzat uz lokalizovane aby sa tu mohli vypisat
    $pageNotFoundBox = new PageNotFoundBox();
    $pageNotFoundBox->setMessage($e->getMessage());
    $content = $pageNotFoundBox->render();
    MySmarty::assign('content', $content);
}
$upperPartBox = new UpperPartBox();
MySmarty::assign('upperPart', $upperPartBox->render());
// nacachujeme si menu
$memcache = BangMemcache::instance();
$key = 'main_menu_' . $language . '_' . $actionAlias;
$menu = $memcache->get($key);
if (!$menu) {
    $menuBox = new MenuBox();
    $menuBox->setActualAction($action);
    $menu = $menuBox->render();
    $memcache->set($key, $menu, NULL, '+2 hours');
}
MySmarty::assign('menu', $menu);
MySmarty::assign('title', BangSeo::getTitle());
MySmarty::assign('description', BangSeo::getDescription());
MySmarty::assign('keywords', BangSeo::getKeywords());
MySmarty::assign('actualYear', date('Y'));
MySmarty::assign('baseUrl', BASE_URL);
echo MySmarty::fetch('index.tpl');
            $category->setName($categoryName);
            $transaction->commit();
        } elseif ($action === "remove") {
            try {
                $key = htmlentities($_POST['key']);
                $transaction = new Transaction(new MySqlDB());
                $transaction->start();
                $categoryItem = Factory::getView(new CategoryKey($key));
                $categoryItem->setActive(0);
                $transaction->commit();
            } catch (Exception $e) {
                print_r($e);
            }
        }
    }
    $userCategories = Category::getOptions(array("USER_ID" => $user->getId(), "ACTIVE" => 1));
    $allCategories = Category::getOptions(array("ACTIVE" => 1));
    $smarty->assign('allCategories', $allCategories);
    $smarty->assign('userCategories', $userCategories);
    if ($fullPage) {
        $smarty->assign('user', $user);
        $smarty->assign('left_menu', true);
        $smarty->display('category.tpl');
    } else {
        echo $smarty->fetch('category_list.tpl');
    }
} catch (AccessDeniedException $e) {
    trigger_error('Access Denied');
} catch (Exception $e) {
    trigger_error('An error has occurred, please try again in a few minutes');
}