예제 #1
0
 private function getFinalModalArray()
 {
     $aReturn = array();
     $game = $this->getActiveGame();
     if ($this->isGameCompleated()) {
         $template = WF::build('EasyTemplate', array(dirname(__FILE__) . '/templates/'));
         /** @var $template EasyTemplate  */
         $template->set_vars(array('game' => $game));
         $aReturn['text'] = $template->render('modal-form');
         $aReturn['title'] = $game->getEntryFormTitle();
         $aReturn['image'] = ScavengerHunt::formatSpriteForJS($game->getFinishPopupSprite());
     }
     return $aReturn;
 }
 /**
  * @return array|bool|Mixed
  */
 public function getJSParamsForCurrent()
 {
     $cityId = $this->app->wg->cityId;
     $articleName = $this->app->wg->title->getPartialURL();
     if (!$this->isPagePartOfAnyHunt($cityId, $articleName)) {
         return false;
     }
     $key = wfSharedMemcKey('ScavengerHuntIndexer', $cityId, md5($articleName));
     $value = $this->getCache()->get($key);
     if (empty($value)) {
         self::log('performance', __METHOD__);
         $enabledGames = $this->getEnabledGames();
         $value = array();
         foreach ($enabledGames as $game) {
             $template = WF::build('EasyTemplate', array(dirname(__FILE__) . '/../templates/'));
             /* @var $template EasyTemplate */
             $template->set_vars(array('game' => $game));
             if ($game->getLandingArticleName() == $articleName) {
                 $value['wgScavengerHuntStart'][] = (int) $game->getId();
                 $value['wgScavengerHuntStartMsg'][] = $game->getLandingButtonText();
                 $value['wgScavengerHuntStartPosition'][] = array('X' => $game->getLandingButtonX(), 'Y' => $game->getLandingButtonY());
                 $value['wgScavengerHuntStartClueTitle'][] = $game->getStartingClueTitle();
                 $value['wgScavengerHuntSpriteImg'][] = $game->getSpriteImg();
                 $value['wgScavengerHuntSprite'][] = ScavengerHunt::formatSpriteForJS(array('sprite' => $game->getStartPopupSprite()), 'sprite');
                 $value['wgScavengerHuntStartClueHtml'][] = $template->render('modal-starting');
             }
         }
         $value['wgCookieDomain'] = $this->app->wg->cookieDomain;
         $this->getCache()->set($key, $value, self::CACHE_TTL);
     } else {
         self::log('performance(cache)', __METHOD__);
     }
     return $value;
 }