コード例 #1
0
ファイル: create.php プロジェクト: OwlManAtt/kittokittokitto
     $color = $color->findOneBy(array(array('table' => 'pet_specie_color', 'column' => 'color_img', 'value' => $color_id), array('table' => 'pet_specie', 'column' => 'pet_specie_id', 'value' => $specie->getPetSpecieId()), array('table' => 'pet_specie_color', 'column' => 'base_color', 'value' => 'Y')));
     if ($color == null) {
         $ERRORS[] = 'Invalid color specified.';
     }
 }
 // end pet exists
 if (sizeof($ERRORS) > 0) {
     draw_errors($ERRORS);
 } else {
     // Add pet.
     $pet = new Pet($db);
     $pet->setUserId($User->getUserId());
     $pet->setPetSpecieId($specie->getPetSpecieId());
     $pet->setPetSpecieColorId($color->getPetSpecieColorId());
     $pet->setPetName($pet_name);
     $pet->setHunger($specie->getMaxHunger());
     $pet->setHappiness($specie->getMaxHappiness());
     $pet->setCreatedAt($pet->sysdate());
     $pet->save();
     // If the user has no other pets, make this the active one.
     if (sizeof($User->grabPets()) == 0) {
         $pet->makeActive();
     }
     // Session mog
     $_SESSION['hilight_pet_id'] = $pet->getUserPetId();
     // Redirect
     redirect('pets');
 }
 // end no errors; DO IT
 break;
 // end spawn