public function actionDeletedetails($id)
 {
     $vehicle = VehicleDetails::model()->findByAttributes(array('id' => $id));
     $vehicle->is_deleted = '1';
     $vehicle->save();
     $driver = DriverDetails::model()->findByAttributes(array('vehicle_id' => $id));
     $driver->status = NULL;
     $driver->save();
     $fuel = FuelConsumption::model()->DeleteAllByAttributes(array('vehicle_id' => $id));
     $bus = BusLog::model()->DeleteAllByAttributes(array('vehicle_id' => $id));
     $this->redirect(array('manage'));
 }
Example #2
0
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top" width="75%">
        <div class="cont_right">
<h1><?php 
echo Yii::t('transport', 'Transport Dashboard');
?>
</h1>

<div class="pdtab_Con">
<div style="font-size:13px; padding:5px 0px"><strong><?php 
echo Yii::t('transport', 'Bus Log');
?>
</strong></div>
 <?php 
$route = BusLog::model()->findAll();
?>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr class="pdtab-h">
        	<td align="center"><?php 
echo Yii::t('transport', 'Vehicle Code');
?>
</td>
        	<td align="center"><?php 
echo Yii::t('transport', 'Start Time Reading');
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'End Time Reading');
?>
</td>
Example #3
0
<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'fuel-consumption-form', 'enableAjaxValidation' => false));
?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php 
echo $form->errorSummary($model);
if (isset($_REQUEST['id']) && $_REQUEST['id'] != NULL) {
    $route = BusLog::model()->findByAttributes(array('id' => $_REQUEST['id']));
    if ($route != NULL) {
        $id = $route->vehicle_id;
    }
    ?>
 <div class="formCon" >
<div class="formConInner">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>
                <?php 
    //echo $form->labelEx($model,Yii::t('transport','vehicle_id'));
    ?>
            </td>
            <td>&nbsp;
            </td>
            <td>
             <?php 
    echo $form->hiddenField($model, 'vehicle_id', array('size' => 20, 'value' => $id));
    ?>
 /**
  * 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 = BusLog::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }