Advertisement
Guest User

Untitled

a guest
May 26th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1.  function add_inst() {
  2.         $this->autoLayout = false;
  3.  
  4.         if (isset($_GET['save_inst'])) {
  5.             $inst_data = $_GET['data']['Institution'];
  6.             $this->Institution->save($inst_data);
  7.             $inst_id = $this->Institution->id;
  8.             $inst = new Institution();
  9.             $inst_data = $inst->find("first", array('conditions' => array("Institution.id" => $inst_id)));
  10.             $this->Site->set(array(
  11.                 'site_inst_id' => $inst_data['Institution']['id'],
  12.                 'site_name' => $inst_data['Institution']['inst_short_name'] . " Default Site",
  13.                 'phone' => $inst_data['Institution']['phone'],
  14.                 'fax' => $inst_data['Institution']['fax'],
  15.                 'email' => $inst_data['Institution']['email'],
  16.                 'city' => $inst_data['Institution']['city'],
  17.                 'address' => $inst_data['Institution']['address']
  18.             ));
  19.             $this->Site->save();
  20.             echo json_encode(array("status" => "1"));
  21.             exit();
  22.         } else if (isset($_GET['id']) && $_GET['edit_inst'] == 'true') {
  23.  
  24.             $id = $_GET['id'];
  25.             $institutions = $this->Institution->find("first", array("conditions" => array("Institution.id" => $id)));
  26.             $this->set(compact('institutions'));
  27.         } else {
  28.             // echo "Current Site--".Configure::read("inst_id");
  29.         }
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement