Exemplo n.º 1
0
 public function save_data()
 {
     $ObjQuery = new queryModel();
     $ObjList = new listingsModel();
     $list_id = Input::get('list_id');
     $license_no = Input::get('license_no');
     $estimator_fullname = Input::get('estimator_fullname');
     $estimator_phone = Input::get('estimator_phone');
     $estimator_email = Input::get('estimator_email');
     $estimator_website = Input::get('estimator_website');
     $estimator_address = Input::get('estimator_address');
     $estimator_zipcode = Input::get('estimator_zipcode');
     $estimator_city = Input::get('estimator_city');
     $commentary = Input::get('commentary');
     $classifications = Input::get('classifications');
     $trades = Input::get('trades');
     $vendor1 = Input::get('vendor1');
     $vendor2 = Input::get('vendor2');
     $vendor3 = Input::get('vendor3');
     $classifications = serialize($classifications);
     $trades = serialize($trades);
     $data = array($ObjList->tblpref . 'license_no' => $license_no, $ObjList->tblpref . 'estimator_fullname' => $estimator_fullname, $ObjList->tblpref . 'estimator_phone' => $estimator_phone, $ObjList->tblpref . 'estimator_email' => $estimator_email, $ObjList->tblpref . 'estimator_website' => $estimator_website, $ObjList->tblpref . 'estimator_address' => $estimator_address, $ObjList->tblpref . 'estimator_zipcode' => $estimator_zipcode, $ObjList->tblpref . 'estimator_city' => $estimator_city, $ObjList->tblpref . 'commentary' => $commentary, $ObjList->tblpref . 'classifications' => $classifications, $ObjList->tblpref . 'trades' => $trades, $ObjList->tblpref . 'vendor1' => $vendor1, $ObjList->tblpref . 'vendor2' => $vendor2, $ObjList->tblpref . 'vendor3' => $vendor3);
     if ($list_id) {
         $result = $ObjList->update_data($data, $list_id);
         if ($result) {
             $message = 'Save data successful.';
             return Redirect::to('listings_edit/' . $list_id)->with('message', $message);
         } else {
             $this->edit($list_id);
         }
     } else {
         $list_id = $ObjList->insert_data($data);
         if ($list_id) {
             $message = 'Save data successful.';
             return Redirect::to('listings_edit/' . $list_id)->with('message', $message);
         } else {
             $this->edit($list_id);
         }
     }
 }