public function actionAdd() { $firmId = $this->request->getParam("firm_id"); $subspecialtyId = $this->request->getParam("subspecialty_id"); $leafletId = $this->request->getParam("leaflet_id"); if (!Yii::app()->request->isAjaxRequest) { $this->render("errorpage", array("errormessage" => "notajaxcall")); } else { if (!is_numeric($leafletId)) { echo "error 1"; } elseif ($firmId > 0) { $newLFF = new OphTrConsent_Leaflet_Firm(); $newLFF->firm_id = $firmId; $newLFF->leaflet_id = $leafletId; if ($newLFF->save()) { echo "success"; } else { echo "error 2"; } } elseif ($subspecialtyId > 0) { $newLFS = new OphTrConsent_Leaflet_Subspecialty(); $newLFS->subspecialty_id = $subspecialtyId; $newLFS->leaflet_id = $leafletId; if ($newLFS->save()) { echo "success"; } else { echo "error 3"; } } } }
public function actionAdd() { $firmId = $this->request->getParam('firm_id'); $subspecialtyId = $this->request->getParam('subspecialty_id'); $leafletId = $this->request->getParam('leaflet_id'); if (!Yii::app()->request->isAjaxRequest) { $this->render('errorpage', array('errormessage' => 'notajaxcall')); } else { if (!is_numeric($leafletId)) { echo 'error 1'; } elseif ($firmId > 0) { $newLFF = new OphTrConsent_Leaflet_Firm(); $newLFF->firm_id = $firmId; $newLFF->leaflet_id = $leafletId; if ($newLFF->save()) { echo 'success'; } else { echo 'error 2'; } } elseif ($subspecialtyId > 0) { $newLFS = new OphTrConsent_Leaflet_Subspecialty(); $newLFS->subspecialty_id = $subspecialtyId; $newLFS->leaflet_id = $leafletId; if ($newLFS->save()) { echo 'success'; } else { echo 'error 3'; } } } }