Esempio n. 1
0
 public function actionEditSensor()
 {
     $result = array();
     if (isset($_POST['sensor_id'])) {
         $form = new StationSensorEditForm();
         if ($form->loadBySensorId((int) $_POST['sensor_id'])) {
             $result['form'] = $form->draw();
         }
     }
     if (isset($_POST['StationSensorEditForm'])) {
         $form = new StationSensorEditForm();
         $form->attributes = $_POST['StationSensorEditForm'];
         if ($form->validate()) {
             $result = $form->saveSensor();
             if (empty($result)) {
                 $result['form'] = $form->draw();
             }
         } else {
             $result['form'] = $form->draw();
         }
     }
     echo json_encode($result);
     CApplication::end();
 }
Esempio n. 2
0
 public function actionDeleteScheduleTypeDestination()
 {
     $ex_schedule_id = isset($_REQUEST['sid']) ? intval($_REQUEST['sid']) : null;
     $destination_id = isset($_REQUEST['did']) ? intval($_REQUEST['did']) : null;
     $return = array('ok' => 0);
     if ($ex_schedule_id && $destination_id) {
         $res = ScheduleTypeReportDestination::model()->deleteAllByAttributes(array('ex_schedule_id' => $ex_schedule_id, 'ex_schedule_destination_id' => $destination_id));
         if ($res) {
             $return['ok'] = 1;
         }
     }
     print json_encode($return);
     CApplication::end();
 }