/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Transportation();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Transportation'])) {
         $trans = Transportation::model()->findByAttributes(array('student_id' => $_POST['student_id']));
         $model->attributes = $_POST['Transportation'];
         $model->student_id = $_POST['student_id'];
         if ($trans != NULL and $_POST['student_id']) {
             $this->redirect(array('error'));
         } else {
             if (isset($_POST['student_id']) and $_POST['student_id'] != NULL) {
                 $allot = Allotment::model()->findByAttributes(array('student_id' => $_POST['student_id']));
                 if ($allot->student_id == $_POST['student_id']) {
                     $this->redirect(array('warning', 'transportation' => $_POST['Transportation'], 'student_id' => $_POST['student_id']));
                 }
             }
             if (isset($_POST['Transportation']['stop_id']) and $_POST['Transportation']['stop_id'] != NULL) {
                 $stop = StopDetails::model()->findByAttributes(array('id' => $_POST['Transportation']['stop_id']));
                 $route = RouteDetails::model()->findByAttributes(array('id' => $stop->route_id));
                 $vehicle = VehicleDetails::model()->findByAttributes(array('id' => $route->vehicle_id));
                 $connection = Yii::app()->db;
                 $sql = "SELECT t2.id FROM transportation AS t2 JOIN stop_details AS t1   WHERE t2.stop_id = t1.id AND t1.route_id= " . $stop->route_id;
                 $command = $connection->createCommand($sql);
                 $stops = $command->queryAll();
             }
             if ($vehicle->maximum_capacity >= count($stops)) {
                 if ($model->save()) {
                     $this->redirect(array('view', 'id' => $model->id));
                 }
             } else {
                 Yii::app()->user->setFlash('errorMessage', UserModule::t("No seat available in the vehicle!"));
                 $this->redirect(array('create'));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
$criteria->order = 'id DESC';
$total = Transportation::model()->count($criteria);
$pages = new CPagination($total);
$pages->setPageSize(Yii::app()->params['listPerPage']);
$pages->applyLimit($criteria);
// the trick is here!
$route = Transportation::model()->findAll($criteria);
$page_size = Yii::app()->params['listPerPage'];
?>
								<?php 
//$route=Transportation::model()->findAll();
if ($route) {
    foreach ($route as $route1) {
        $student = Students::model()->findByAttributes(array('id' => $route1->student_id));
        $stop = StopDetails::model()->findByAttributes(array('id' => $route1->stop_id));
        $route = RouteDetails::model()->findByAttributes(array('id' => $stop->route_id));
        ?>
	
 
                            <td align="center">
                                <?php 
        echo $student->last_name . ' ' . $student->first_name;
        ?>
                            </td>
                            <td align="center">
                                <?php 
        echo $route->route_name;
        ?>
                            </td>
                            <td align="center">
                                <?php 
 public function actionRemoveAll($id)
 {
     if (is_numeric($id)) {
         StopDetails::model()->deleteAllbyAttributes(array('route_id' => $id));
         $route = RouteDetails::model()->findByPk($id);
         $route->saveAttributes(array('no_of_stops' => 0));
         $this->redirect(array('stopDetails/manage', 'id' => $id));
     } else {
         $this->redirect(array('RouteDetails/manage'));
     }
 }
예제 #4
0
    <td valign="top"> 
    <div class="cont_right">
     <h1><?php 
echo Yii::t('transport', 'Route Details');
?>
</h1>
      <div class="edit_bttns" style="top:20px; right:20px;">
    <ul>
    <li> <?php 
echo CHtml::link('<span>' . Yii::t('transport', 'Enter Route Details') . '</span>', array('/transport/RouteDetails/create'), array('class' => 'addbttn last '));
?>
</li>
    </ul>
    </div>
    <?php 
$route = RouteDetails::model()->findAll();
?>
         <div class="pdtab_Con">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
         <tr class="pdtab-h">
        	<td align="center"><?php 
echo Yii::t('transport', 'Route');
?>
</td>
        	<td align="center"><?php 
echo Yii::t('transport', 'No of stops');
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'No of students');
?>
예제 #5
0
echo Yii::t('transport', 'Assigned Driver');
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'Route');
?>
</td>
            <td align="center"><?php 
echo Yii::t('transport', 'Action');
?>
</td>
        </tr>
        <?php 
if ($vehicle != NULL) {
    foreach ($vehicle as $vehicle_1) {
        $route = RouteDetails::model()->findByAttributes(array('vehicle_id' => $vehicle_1->id));
        $driver = DriverDetails::model()->findByAttributes(array('vehicle_id' => $vehicle_1->id));
        ?>
                <tr>
                	<td align="center"><?php 
        echo $vehicle_1->vehicle_no;
        ?>
</td>
                    <td align="center"><?php 
        echo $vehicle_1->no_of_seats;
        ?>
</td>
                    <td align="center"><?php 
        echo $vehicle_1->maximum_capacity;
        ?>
</td>
예제 #6
0
    <tr>
        <td width="247" valign="top">
            <?php 
$this->renderPartial('/transportation/trans_left');
?>
        </td>
        <td valign="top">
            <div class="cont_right">
                <h1>
                    <?php 
echo Yii::t('transport', 'BusLog');
?>
                </h1>
                <?php 
$driver = StopDetails::model()->findByAttributes(array('id' => $_REQUEST['id']));
$vehicle = RouteDetails::model()->findByAttributes(array('id' => $driver->route_id));
?>
<div class="pdtab_Con" >
                <table width="80%" border="0" cellspacing="0" cellpadding="0">
                    <tr class="pdtab-h">
                        <td>
                            <?php 
echo Yii::t('transport', 'Route');
?>
                        </td>
                        <td>
                            <?php 
echo Yii::t('transport', 'Stop Name');
?>
                        </td>
                        <td>
예제 #7
0
$setup_tim = false;
$setup_lib = false;
$setup_hos = false;
$setup_tra = false;
$setups = 0;
$exp_stu = Students::model()->findAll();
$exp_emp = Employees::model()->findAll();
$exp_cou = Courses::model()->findAll();
$exp_fee = FinanceFeeCategories::model()->findAll();
$exp_tim = TimetableEntries::model()->findAll();
Yii::app()->getModule('library');
$exp_lib = Book::model()->findAll();
Yii::app()->getModule('hostel');
$exp_hos = Hosteldetails::model()->findAll();
Yii::app()->getModule('transport');
$exp_tra = RouteDetails::model()->findAll();
if (count($exp_stu)) {
    $setup_stu = true;
    $setups++;
}
if (count($exp_emp)) {
    $setup_emp = true;
    $setups++;
}
if (count($exp_cou)) {
    $setup_cou = true;
    $setups++;
}
if (count($exp_fee)) {
    $setup_fee = true;
    $setups++;
예제 #8
0
<?php

$this->breadcrumbs = array('Route Details' => array('/transport'), 'RouteDetails');
$form = $this->beginWidget('CActiveForm', array('id' => 'vacate-form', 'enableAjaxValidation' => false));
echo '<strong>' . CHtml::label(Yii::t('transport', 'Select Route'), '') . '</strong>';
//echo CHtml::dropDownList('routeid','',array(),array('prompt'=>'Select','id'=>'stopid'));
echo CHtml::dropDownList('routeid', '', CHtml::listData(RouteDetails::model()->findAll(), 'id', 'route_name'), array('prompt' => 'Select', 'id' => 'route_id', 'submit' => array('RouteDetails/routedetails')));
if (isset($routeid)) {
    if ($routeid == NULL) {
        echo '<div align="center">' . Yii::t('transport', 'Sorry!!&nbsp;No data available now.') . '</div>';
    } else {
        $routedetails = RouteDetails::model()->findByAttributes(array('id' => $routeid));
        $vehicle = VehicleDetails::model()->findByAttributes(array('id' => $routedetails->vehicle_id));
        $stop = StopDetails::model()->findAllByAttributes(array('route_id' => $routeid));
        if ($stop == NULL) {
            echo '<div align="center"><strong>' . Yii::t('transport', 'Sorry!!&nbsp;No data available now.') . '</strong></div>';
        } else {
            ?>
<table width="22%" border="0" cellspacing="0" cellpadding="0">
    <tr>
       
        <td><?php 
            echo Yii::t('transport', 'Route');
            ?>
</td>
        <td><?php 
            echo Yii::t('transport', 'Stop');
            ?>
</td>
        <td><?php 
            echo Yii::t('transport', 'Vehicle ID');
예제 #9
0
echo Yii::app()->request->baseUrl;
?>
/css/jquery.maskedinput-1.3.js" type="text/javascript"></script>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'stop-details-form', 'enableAjaxValidation' => false));
?>
	<?php 
echo $form->errorSummary($model);
?>
    <div class="pdtab_Con formCon">
    <table width="80%" border="0" cellspacing="0" cellpadding="0">
    <?php 
$route = RouteDetails::model()->findByAttributes(array('id' => $_REQUEST['id']));
if ($route != NULL) {
    $cnt = count($model);
    if ($cnt > 0) {
        ?>
		<tr class="pdtab-h">
            <td><?php 
        echo $form->labelEx($model[0], Yii::t('transport', 'stop_name'));
        ?>
</td>
            <td><?php 
        echo $form->labelEx($model[0], Yii::t('transport', 'fare'));
        ?>
</td>
            <td><?php 
        echo $form->labelEx($model[0], Yii::t('transport', 'Morning Arrival'));
 /**
  * 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 = RouteDetails::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #11
0
            	<td width="3%">&nbsp;</td>
            	<td width="55%"><strong><?php 
echo Yii::t('transport', 'Stop');
?>
</strong></td>
               
          </tr>
          <tr>
				<td> <?php 
echo $form->textField($model, 'student_id', array('size' => 20));
?>
</td>
                         <td>&nbsp;</td>
                         <td>
                          <?php 
echo CHtml::dropDownList('route', '', CHtml::listData(RouteDetails::model()->findAll(), 'id', 'route_name'), array('prompt' => 'Select', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('/transport/transportation/routes'), 'update' => '#stop_id', 'data' => 'js:$(this).serialize()')));
?>
</td>
    <td>&nbsp;</td>
						<td> <?php 
//$data = CHtml::listData(RouteDetails::model()->findAll(array('order'=>'route_name DESC')),'id','route_name');
/*echo 'Route';
echo CHtml::dropDownList('route_id','',$data,
array('prompt'=>'Select',
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('/transport/transportation/routes'),
'update'=>'#stop_id',
'data'=>'js:$(this).serialize()'
))); */
//$data1 = CHtml::listData(StopDetails::model()->findAll(array('order'=>'stop_name DESC')),'id','stop_name');