Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add_inst() {
- $this->autoLayout = false;
- if (isset($_GET['save_inst'])) {
- $inst_data = $_GET['data']['Institution'];
- $this->Institution->save($inst_data);
- $inst_id = $this->Institution->id;
- $inst = new Institution();
- $inst_data = $inst->find("first", array('conditions' => array("Institution.id" => $inst_id)));
- $this->Site->set(array(
- 'site_inst_id' => $inst_data['Institution']['id'],
- 'site_name' => $inst_data['Institution']['inst_short_name'] . " Default Site",
- 'phone' => $inst_data['Institution']['phone'],
- 'fax' => $inst_data['Institution']['fax'],
- 'email' => $inst_data['Institution']['email'],
- 'city' => $inst_data['Institution']['city'],
- 'address' => $inst_data['Institution']['address']
- ));
- $this->Site->save();
- echo json_encode(array("status" => "1"));
- exit();
- } else if (isset($_GET['id']) && $_GET['edit_inst'] == 'true') {
- $id = $_GET['id'];
- $institutions = $this->Institution->find("first", array("conditions" => array("Institution.id" => $id)));
- $this->set(compact('institutions'));
- } else {
- // echo "Current Site--".Configure::read("inst_id");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement