function generate_vars($section, &$vars) { if (!$vars['is_logged'] || !$vars['is_admin']) { return; } $arenas = Arena::find_all(); $vars['arenas'] = $arenas; if (isset($_POST['nom0'])) { for ($i = 0; $i < count($arenas); $i++) { $arena = $arenas[$i]; if (isset($_POST['delete' . $i])) { $arena->delete(); continue; } if ($arena->nom != $_POST['nom' . $i] || $arena->largeur != $_POST['largeur' . $i] || $arena->profondeur != $_POST['profondeur' . $i]) { $arena->nom = $_POST['nom' . $i]; $arena->largeur = $_POST['largeur' . $i]; $arena->profondeur = $_POST['profondeur' . $i]; $arena->save(); } } } if (!empty($_POST['nom-nouveau']) && !empty($_POST['largeur-nouveau']) && !empty($_POST['profondeur-nouveau'])) { $arena = new Arena(); $arena->nom = $_POST['nom-nouveau']; $arena->largeur = $_POST['largeur-nouveau']; $arena->profondeur = $_POST['profondeur-nouveau']; $arena->save(); } $arenas = Arena::find_all(); $vars['arenas'] = $arenas; }
function generate_vars($section, &$vars) { if (!$vars['is_logged'] || !$vars['is_admin']) { return; } //echo '--------<br>'; //foreach ($_POST as $x => $y) { // echo $x . ' -> ' . $y . '<br>'; // } //echo '-------<br>'; $arenas = Arena::find_all(); $vars['arenas'] = $arenas; if (isset($_POST['nom0'])) { for ($i = 0; $i < count($arenas); $i++) { $arena = $arenas[$i]; if (isset($_POST['delete' . $i])) { $arena->delete(); continue; } if ($arena->nom != $_POST['nom' . $i] || $arena->sieges != $_POST['sieges' . $i]) { $arena->nom = $_POST['nom' . $i]; $arena->sieges = $_POST['sieges' . $i]; $arena->save(); } } } if (!empty($_POST['nom-nouveau']) && !empty($_POST['sieges-nouveau'])) { $arena = new Arena(); $arena->nom = $_POST['nom-nouveau']; $arena->sieges = $_POST['sieges-nouveau']; $arena->save(); } $arenas = Arena::find_all(); $vars['arenas'] = $arenas; }
function display($id) { $arena = new Arena(); $arena->setId($id); $arena = Query::getOne($arena); return $arena; }
function test_save_delete() { $obj = new Arena(); $obj->sieges = 5; $old_count = count(Arena::filter("")); $obj->save(); assert(isset($obj->id)); $obj->sieges = 7; $obj->save(); $obj->delete(); assert($old_count == count(Arena::filter(""))); }
function generate_vars($section, &$vars) { if (!$vars['is_logged'] || !$vars['is_admin']) { return; } $matches = Match::find_all(); $vars['matches'] = $matches; $vars['arenas'] = Arena::filter(''); if (isset($_POST['description0'])) { for ($i = 0; $i < count($matches); $i++) { $match = $matches[$i]; if (isset($_POST['delete' . $i])) { $match->delete(); continue; } if ($match->description != $_POST['description' . $i] || $match->date != $_POST['date' . $i] || $match->arena != $_POST['arena' . $i] || $match->prix != $_POST['prix' . $i]) { $match->description = $_POST['description' . $i]; $match->date = $_POST['date' . $i]; $match->arena = $_POST['arena' . $i]; $match->prix = $_POST['prix' . $i]; $match->save(); } } } if (!empty($_POST['description-nouveau']) && !empty($_POST['date-nouveau']) && !empty($_POST['arena-nouveau']) && !empty($_POST['prix-nouveau'])) { $match = new Match(); $match->description = $_POST['description-nouveau']; $match->date = $_POST['date-nouveau']; $match->arena = $_POST['arena-nouveau']; $match->prix = $_POST['prix-nouveau']; $match->save(); } $matches = Match::find_all(); $vars['matches'] = $matches; }
<?php require_once 'monster.php'; require_once 'kryptonian.php'; require_once 'arena.php'; $kraken = new monster(); $kraken->setStats(100 + rand(50, 1000), rand(200, 400), 30, 100); $kraken->isPresent(true); $superMincho = new kryptonian(); $superMincho->setStats('100', rand(100, 200), '50', '30'); $superMincho->setHeatray(rand(30, 50)); $superMincho->setSuperhumanstrength('100'); $superMincho->setRegeneration(rand(80, 120)); echo "<pre>"; print_r($kraken); print_r($superMincho); $arena = new Arena($kraken, $superMincho); $rounds = $arena->doBattle(); echo "The battle is over in {$rounds}"; echo "<pre>"; print_r($kraken); print_r($superMincho);
public function canJoin(Player $player) { return $this->arena->getPlayerManager()->getPlayersCount() < $this->arena->getStructureManager()->getMaxPlayer() and !$this->arena->getStatusManager()->isStarting() and !$this->arena->getStatusManager()->isRunning(); }
<?php /* * Arena channel-in-channel example * * */ include '../../arena.php'; $arena = new Arena(); $slug = 'interesting-menu'; // channel slug (e.g. http://are.na/interesting-menu) $channel = $arena->get_channel($slug); ?> <!DOCTYPE html> <html> <head> <title><?php echo $channel->title; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://www.w3.org/StyleSheets/Core/Modernist" type="text/css"> <style type="text/css"> img, iframe{padding-left: 11%;} p, p:first-child{padding-right: 11%} div > p:first-child, body > p:first-child, td > p:first-child{padding-right: 11%} a.img{background-color: #fff;} #contents h3 a{ color:#000; background-color: #ccc;
public function getArena() { return Arena::get($this->arena); }
<?php /* * Arena User Channel List Example * * */ include '../../arena.php'; $arena = new Arena(); $user_slug = 'dena-yago'; // user slug (e.g. http://are.na/dena-yago) $user = $arena->get_user($user_slug); $channels = $arena->get_user_channels($user_slug); ?> <!DOCTYPE html> <html> <head> <title><?php echo $user->username; ?> 's Channels</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"> <style type="text/css"> .loading{background-color: #eee; opacity: 0.4;} #content.loading{text-indent: 100%;overflow: hidden;} #content{min-height: 100%;} </style> </head> <body>
<?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); include 'arena.php'; $arena = new Arena(); $page = $arena->set_page(); // this checks if page is set, if not sets page to 1 $per = 24; // how many items per page $slug = 'blend-is-beautiful'; // channel slug (e.g. http://are.na/arena-influences) $channel = $arena->get_channel($slug, array('page' => $page, 'per' => $per)); ?> <!DOCTYPE html> <html> <head> <title><?php echo $channel->title; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="assets/css/app.css" type="text/css"> </head> <body> <nav id="options"> <a href="index.php">Blend</a> <a href="catalog.php" class="current">Catalog</a>
<?php /* * Arena Document Example / Permalink * * */ include '../../arena.php'; $arena = new Arena(); $item = $arena->get_block($_GET['id']); ?> <!DOCTYPE html> <html> <head> <title><?php echo $channel->title; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="http://www.w3.org/StyleSheets/Core/Modernist" type="text/css"> <style type="text/css"> img, iframe{padding-left: 11%;} p, p:first-child{padding-right: 11%} div > p:first-child, body > p:first-child, td > p:first-child{padding-right: 11%} a.img{background-color: #fff;} </style> </head> <body> <div id="contents">
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <meta charset="UTF-8"> <title>Bojovníci</title> </head> <body> <?php function nactiTridu($trida) { require "{$trida}.php"; } spl_autoload_register("nactiTridu"); $gandalf = new Kouzelnik("Gandalf", 100, 70, 70, 100); $zalgoren = new Bojovnik("Zalgoren", 100, 60, 60); $arena = new Arena(); $arena->vloz($zalgoren, $gandalf); $arena->boj(); ?> </body> </html>
/** * @test * @depends arena_tiles_can_be_returned_and_inpected * @depends new_game_should_contain_only_empty_tiles * @depends occupation_of_a_tile_on_a_rulesless_game * @TODO Move Method: This belongs to Neighbour test. */ public function rule_of_neighbours_are_applied() { $arenaLimits = new Geometry\Cartesian\Point(4, 4); $rules = array('Neibor' => 'Iannsp\\PhpWar\\Game\\Score\\Neibor'); $arena = new Arena($arenaLimits, $rules); $alice = 'A'; $bob = 'B'; $this->assertCount(1, $arena->play($alice, new Move(0, 1))->getWinners(), 'Alice should be able to move to an uncoppied tile.'); $this->assertCount(1, $arena->play($alice, new Move(1, 1))->getWinners(), 'Alice should be able to move to an uncoppied tile.'); $this->assertCount(1, $arena->play($alice, new Move(1, 0))->getWinners(), 'Alice should be able to move to an uncoppied tile.'); $this->assertCount(1, $arena->play($bob, new Move(0, 0))->getLosers(), 'Bob can\'t move to an unocoppied tile where Alice is a nighbour. He got shot in tha face!'); $this->assertCount(1, $arena->play($bob, new Move(1, 1))->getLosers(), 'Bob could occupy Alice\'s tile if it had no hostile (Alice\'s) nieghbours. He got shot in tha face, again!'); }
<?php /* * Arena POST Image data example * * * (Canvas to POST code from: http://permadi.com/blog/2010/10/html5-saving-canvas-image-data-using-php-and-ajax/) */ $slug = 'drawings'; if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) { // save image data to file $imageData = $GLOBALS['HTTP_RAW_POST_DATA']; $filteredData = substr($imageData, strpos($imageData, ",") + 1); $unencodedData = base64_decode($filteredData); $fp = fopen('test.png', 'wb'); fwrite($fp, $unencodedData); fclose($fp); $url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "test.png"; // post to arena include '../../../arena.php'; $arena = new Arena(); $block = $arena->create_block($slug, array('source' => $url)); $arena->select_block($block->connection_id); }
<?php /** * Copyright 2015 * Unauthorized use of the contents of this site without the prior written consent is forbidden. */ require 'classes/Warrior.php'; require 'classes/Arena.php'; $warriors = array(0 => array('strenght' => 50, 'stamina' => 300, 'luck' => 10, 'arrmor' => 31, 'acrobatics' => 15, 'name' => 'Orc'), 1 => array('strenght' => 40, 'stamina' => 223, 'luck' => 25, 'arrmor' => 22, 'acrobatics' => 60, 'name' => 'Hobit')); echo '<pre>'; print_r($warriors); echo '</pre><hr>'; $warrior1 = new Warrior($warriors[0], $warriors[0]['name']); $warrior2 = new Warrior($warriors[1], $warriors[1]['name']); $arena = new Arena($warrior1, $warrior2); $arena->startFight(); foreach ($arena->getFightLog() as $logLine) { echo $logLine; } echo '<h1><font color="lime">Fight win ' . $arena->getWinner()->getName() . '</font></h1>';