public function actionChangestatusawb() { $driver = Driver::model()->findByAttributes(array('token' => $_REQUEST['token'])); $awbs = explode("|", $_REQUEST['awb']); $retAwb = array(); foreach ($awbs as $awb) { $shipment = Shipment::model()->findByAttributes(array('awb' => $awb)); if ($shipment == null) { continue; } $retAwb[] = $awb; $shipment->shipping_status = isset($_REQUEST['shipment_status']) ? $_REQUEST['shipment_status'] : null; $shipment->shipping_remark = isset($_REQUEST['shipment_status']) ? $_REQUEST['shipment_status'] : null; $shipment->recipient_name = isset($_REQUEST['recipient_name']) ? $_REQUEST['recipient_name'] : ''; $shipment->recipient_title = isset($_REQUEST['recipient_title']) ? $_REQUEST['recipient_title'] : ''; $shipment->save(false); if (isset($_REQUEST['image'])) { $potoBarang = new PotoBarang(); $potoBarang->time = time(); $potoBarang->users_id = $driver->user_id; $potoBarang->image = $_REQUEST['image']; $potoBarang->awb = $awb; $potoBarang->shipment_id = $shipment->id; $potoBarang->Save(false); } $shipmentEvent = new ShipmentEvent(); $shipmentEvent->shipment_id = $shipment->id; $shipmentEvent->user_id = $driver->user_id; $shipmentEvent->status = isset($_REQUEST['shipment_status']) ? $_REQUEST['shipment_status'] : null; $shipmentEvent->created = time(); $shipmentEvent->event_time = time(); $shipmentEvent->description = isset($_REQUEST['keterangan']) ? $_REQUEST['keterangan'] : ''; $shipmentEvent->save(false); } echo CJSON::encode($this->statusSuccess($retAwb)); }
public function actionUploadbarang() { $pathRoot = Yii::app()->basePath; echo CJSON::encode($this->statusSuccess(array('token' => $_REQUEST['token'], 'image' => $_REQUEST['image']))); $driver = Driver::model()->findByAttributes(array('token' => $_REQUEST['token'])); $potoBarang = new PotoBarang(); $potoBarang->time = time(); $potoBarang->users_id = $driver->user_id; $potoBarang->image = $_REQUEST['image']; $potoBarang->Save(false); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = PotoBarang::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }