public function add()
 {
     $location = new LocationForm();
     $form = $location->form();
     if ($this->request->isPost()) {
         $form->setFieldValues($this->request->getPost());
         if ($form->isValid()) {
             $country_name = $this->request->getPost('lace-country-name');
             //get country
             $country_iso3 = $this->request->getPost('lace-country-iso3');
             //get iso3
             $country_iso2 = $this->request->getPost('lace-country-iso2');
             //get iso2
             $post_code = $this->request->getPost('lace-postcode');
             //get post code
             $enabled = $this->request->getPost('lace-enabled');
             //get enabled
             $location = new Location();
             $location->save(['name' => $country_name, 'iso_code_3' => $country_iso3, 'iso_code_2' => $country_iso2, 'postcode_required' => isset($post_code) ? $post_code : 0, 'status' => isset($enabled) ? $enabled : 0]);
             //redirect to country
             $this->session->setRequestValue('success', 'Country Successfully Added', 1);
             $this->response->redirect($this->request->getBasePath() . '/' . $this->request->getPath(0) . '/locations');
         }
     }
     $this->setView('location/add_country');
     $this->view->title = 'Add Location';
     $this->view->form = $form;
     $this->response->setBody($this->view->render());
     $this->response->send();
 }
Esempio n. 2
0
        echo "</div>";
    }
    ?>
</h1>

<?php 
}
include_once "classes/PopLocations.php";
include_once "classes/Contact.php";
/*Database coding: this checks for multiple different actions made by users and responds accordingly.*/
include_once 'classes/LocationForm.php';
include_once 'classes/EdittingTools.php';
//Make a new room, a new tool bar, and a new form
//$rooms = new Room();
$tool = new EdittingTools();
$locationForm = new LocationForm("auto", 2);
/*//infoKey generates a set of key names to store the key values
$infoKey = array("name", "wiki_id", "client_location", "notes", "T_room_name", "T_room_email", "T_room_phone", "S_room_name", "S_room_email", "S_room_phone", "E_room_name", "E_room_email", "E_room_phone", "B_room_name", "B_room_email", "B_room_phone");
				
//heading is the array of headlines in the table
$headings = array("Location Details", 
				  "*<break>*", "Primary Technical Room", 
				  "*<break>*", "Primary Emergency Room", 
				  "*<break>*", "Primary Service Room", 
				  "*<break>*", "Primary Billing Room");
							
//titles are the subcategories for each headline. In the array "heading" means make a room there for the headline
$titles = array("Location Name", "Location ID", "Location Location", "Notes", 
				"*<break>*", 
				"Name", "Email", "Phone Number", 
				"*<break>*", 
 public function configure()
 {
     parent::configure();
     unset($this['location_scope_id']);
 }