Created
May 31, 2012 16:20
-
-
Save anonymous/2844531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function action_create() | |
{ | |
if (Input::method() == 'POST') | |
{ | |
$val = Model_Apartment::validate('create'); | |
if($val->run()) | |
{ | |
$apartment = Model_Apartment::insert(static::$_user['id']); | |
if($apartment and $apartment->save()) | |
{ | |
Session::set_flash('success', 'Added your apartment '.$apartment->name.'.'); | |
Response::redirect('admin/apartments'); | |
} | |
else | |
{ | |
Session::set_flash('error', 'Could not save apartment.'); | |
} | |
} | |
else | |
{ | |
$this->template->set_global('val', $val->validated(), false); | |
Session::set_flash('error', $val->show_errors()); | |
} | |
} | |
$this->theme->get_template() | |
->set_safe('title', 'Create Apartment › Paris Apartments') | |
->set_safe('css', \Asset::css(array( | |
'aristo.css', | |
'jquery.Jcrop.css', | |
))) | |
->set_safe('js', \Asset::js(array( | |
'http://maps.google.com/maps/api/js?sensor=false', | |
'jquery.Jcrop.min.js', | |
'plupload.full.js', | |
'spin.min.js', | |
)) . $this->theme->asset->js(array( | |
'global_rates.js', | |
'uploader.js', | |
'location.js', | |
'bedrooms.js', | |
'charges.js', | |
'amenities.js' | |
))); | |
$this->theme->set_partial('content', 'admin/apartments/create') | |
->set_safe('amenities', Model_Apartment_Amenity::select_featured()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment