Exemplo n.º 1
0
 /**
  * Deleted checked backgrounds.
  */
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $backgroundId) {
             if (!($background = Background::find($backgroundId))) {
                 continue;
             }
             $background->delete();
         }
         Flash::success(Lang::get('abnmt.theater::lang.backgrounds.delete_selected_success'));
     } else {
         Flash::error(Lang::get('abnmt.theater::lang.backgrounds.delete_selected_empty'));
     }
     return $this->listRefresh();
 }
Exemplo n.º 2
0
 function test_find()
 {
     //Arrange
     $name = "Fighter";
     $description = "stuff";
     $id = 1;
     $test_class = new Background($name, $description, $id);
     $test_class->save();
     $name2 = "Wizard";
     $description2 = "other stuff";
     $test_class2 = new Background($name2, $description2);
     $test_class2->save();
     //Act
     $result = Background::find($test_class->getId());
     //Assert
     $this->assertEquals($test_class, $result);
 }
Exemplo n.º 3
0
    $_SESSION['eye_color'] = $_POST['eye_color'];
    $_SESSION['hair_color'] = $_POST['hair_color'];
    $_SESSION['skin_tone'] = $_POST['skin_tone'];
    $_SESSION['alignment'] = $_POST['alignment'];
    $_SESSION['other'] = $_POST['other'];
    $found_race = Race::find($_SESSION['race']);
    $found_race->getName();
    $found_class = CharClass::find($_SESSION['class']);
    $found_class->getName();
    $found_background = Background::find($_SESSION['background']);
    $found_background->getName();
    return $app['twig']->render('summary.html.twig', array('race' => $found_race, 'class' => $found_class, 'background' => $found_background, 'str' => $_SESSION['str'], 'dex' => $_SESSION['dex'], 'con' => $_SESSION['con'], 'wis' => $_SESSION['wis'], 'int' => $_SESSION['int'], 'cha' => $_SESSION['cha'], 'skills' => $_SESSION['skill'], 'name' => $_SESSION['name'], 'age' => $_SESSION['age'], 'gender' => $_SESSION['gender'], 'height' => $_SESSION['height'], 'eye_color' => $_SESSION['eye_color'], 'hair_color' => $_SESSION['hair_color'], 'skin_tone' => $_SESSION['skin_tone'], 'alignment' => $_SESSION['alignment'], 'other' => $_SESSION['other'], 'races' => Race::getAll(), 'classes' => CharClass::getAll(), 'backgrounds' => Background::getAll()));
});
//return to race page and save to database
$app->get('/summary', function () use($app) {
    Finalize::run();
    return $app['twig']->render('race.html.twig');
});
//print page
//render print page
$app->get('/print', function () use($app) {
    $character = Finalize::run();
    $found_race = Race::find($_SESSION['race']);
    $found_race->getName();
    $found_class = CharClass::find($_SESSION['class']);
    $found_class->getName();
    $found_background = Background::find($_SESSION['background']);
    $found_background->getName();
    return $app['twig']->render('print.html.twig', array("character" => $character, 'race' => $found_race, 'class' => $found_class, 'background' => $found_background, 'str' => $_SESSION['str'], 'dex' => $_SESSION['dex'], 'con' => $_SESSION['con'], 'wis' => $_SESSION['wis'], 'int' => $_SESSION['int'], 'cha' => $_SESSION['cha'], 'skills' => $_SESSION['skill'], 'name' => $_SESSION['name'], 'age' => $_SESSION['age'], 'gender' => $_SESSION['gender'], 'height' => $_SESSION['height'], 'eye_color' => $_SESSION['eye_color'], 'hair_color' => $_SESSION['hair_color'], 'skin_tone' => $_SESSION['skin_tone'], 'alignment' => $_SESSION['alignment'], 'other' => $_SESSION['other'], 'races' => Race::getAll(), 'classes' => CharClass::getAll(), 'backgrounds' => Background::getAll()));
});
return $app;