thadarawgs.view.php - hadarawgs - Hadara adaptation for boardgamearena.com
 (HTM) git clone git://git.z3bra.org/hadarawgs.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       thadarawgs.view.php (2110B)
       ---
            1 <?php
            2 /**
            3  *------
            4  * BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
            5  * hadarawgs implementation : © Willy Goiffon <dev@z3bra.org>
            6  *
            7  * This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
            8  * See http://en.boardgamearena.com/#!doc/Studio for more information.
            9  * -----
           10  *
           11  * hadarawgs.view.php
           12  *
           13  * This is your "view" file.
           14  *
           15  * The method "build_page" below is called each time the game interface is displayed to a player, ie:
           16  * _ when the game starts
           17  * _ when a player refreshes the game page (F5)
           18  *
           19  * "build_page" method allows you to dynamically modify the HTML generated for the game interface. In
           20  * particular, you can set here the values of variables elements defined in hadarawgs_hadarawgs.tpl (elements
           21  * like {MY_VARIABLE_ELEMENT}), and insert HTML block elements (also defined in your HTML template file)
           22  *
           23  * Note: if the HTML of your game interface is always the same, you don't have to place anything here.
           24  *
           25  */
           26 
           27 require_once( APP_BASE_PATH."view/common/game.view.php" );
           28 
           29 class view_hadarawgs_hadarawgs extends game_view
           30 {
           31         function getGameName() {
           32                 return "hadarawgs";
           33         }
           34         function build_page( $viewArgs )
           35         {
           36                 // Get players & players number
           37                 $players = $this->game->loadPlayersBasicInfos();
           38                 $players_nbr = count( $players );
           39 
           40                 /*********** Place your code below:  ************/
           41                 /*
           42                  * Examples: set the value of some element defined in your tpl file like this: {MY_VARIABLE_ELEMENT}
           43                  $this->tpl['MY_VARIABLE_ELEMENT'] = $number_to_display;
           44                  $this->tpl['MY_VARIABLE_ELEMENT'] = self::_("A string to be translated");
           45                  $this->tpl['MY_VARIABLE_ELEMENT'] = self::raw( $some_html_code );
           46                  */
           47 
           48                 $this->page->begin_block( "hadarawgs_hadarawgs", "player" );
           49                 foreach( $players as $player_id=>$player ) {
           50                         $this->page->insert_block( "player", array(
           51                                 "PLAYER_ID" => $player_id,
           52                                 "PLAYER_NAME" => $player['player_name'],
           53                                 "PLAYER_COLOR" => $player['player_color'],
           54                                 )
           55                         );
           56                 }
           57 
           58                 /*********** Do not change anything below this line  ************/
           59         }
           60 }