Ejemplo n.º 1
0
 /**
  * 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 = Pickup::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 2
0
 public function actionAssigncancel()
 {
     if (!isset($_REQUEST['token']) && !isset($_REQUEST['awb'])) {
         echo CJSON::encode($this->statusError(0));
     } else {
         $driver = Driver::getUserId($_REQUEST['token']);
         $shipment = Shipment::model()->findByAttributes(array('awb' => $_REQUEST['awb'], 'shipping_status' => 11));
         if ($shipment == null) {
             echo CJSON::encode($this->statusError('shippment null'));
         } else {
             $shipment->shipping_status = 1;
             $shipment->save(false);
             $shipmentEvent = new ShipmentEvent();
             $shipmentEvent->shipment_id = $shipment->id;
             $shipmentEvent->user_id = $driver;
             $shipmentEvent->status = 1;
             $shipmentEvent->created = time();
             $shipmentEvent->event_time = time();
             $shipmentEvent->description = isset($_REQUEST['keterangan']) ? $_REQUEST['keterangan'] : '';
             $shipmentEvent->save(false);
             $pickup = Pickup::model()->findByAttributes(array('shipment_id' => $shipment->id));
             $pickup->delete(false);
             echo CJSON::encode($this->statusSuccess(1));
         }
     }
     Yii::app()->end();
 }
Ejemplo n.º 3
0
<?php

$redirect = $this->getAction()->id;
$this->widget('zii.widgets.grid.CGridView', array('id' => 'assign_courier-grid', 'dataProvider' => $driver_list_available, 'htmlOptions' => array('class' => 'hastable'), 'columns' => array(array('header' => 'Driver Name', 'type' => 'raw', 'name' => 'user.username', 'value' => function ($data, $row) use($shipment_id, $redirect) {
    return CHtml::link($data->user->username, array('pickup/' . $redirect, 'driver_id' => $data->user_id, 'shipment_id' => $shipment_id), array('class' => 'assign', 'id' => $data->user_id));
}), 'routing_code', array('header' => 'Assignment', 'type' => 'raw', 'value' => function ($data, $row) use($shipment_id) {
    return Pickup::model()->with(array('shipment' => array('condition' => 'shipping_status=11')))->count('driver_id=:driver_id', array(':driver_id' => $data->user_id));
}))));