/** * 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 = StopDetails::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
$criteria = new CDbCriteria(); $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">
public function actionRoutes() { if (isset($_POST['route'])) { $data = StopDetails::model()->findAll('route_id=:x', array(':x' => $_POST['route'])); } echo CHtml::tag('option', array('value' => 0), CHtml::encode('Select'), true); $data = CHtml::listData($data, 'id', 'stop_name'); foreach ($data as $value => $title) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($title), true); } }
<table width="100%" border="0" cellspacing="0" cellpadding="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>
<?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!! 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!! 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');
<table> <tr> <td>Add <input type="text" name="stops" id="noOfStops" style="width:40px;" /> stops</td><td><input type="submit" value="Go" onclick="return checkStops();" /></td> <td> <?php Yii::app()->clientScript->registerScript('myHideEffect', '$(".error").animate({opacity: 1.0}, 5000).fadeOut("slow");', CClientScript::POS_READY); ?> <div class="error" id="error" style="background:#FFF; color:#C00; padding-left:10px; visibility:hidden;"> </div> </td> </tr> </table> <?php $stop = StopDetails::model()->findAll('route_id =:x', array(':x' => $_REQUEST['id'])); if ($stop != NULL) { ?> <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', 'Stop Name'); ?> </td> <td align="center"><?php echo Yii::t('transport', 'Fare'); ?> </td> <td align="center"><?php echo Yii::t('transport', 'Arrival Time(Morning)');
<td align="center"><?php echo Yii::t('transport', 'Stop'); ?> </td> <td align="center"><?php echo Yii::t('transport', 'Action'); ?> </td> </tr> <?php if ($list == NULL) { echo '<tr><td align="center" colspan="4"><strong>' . Yii::t('transport', 'No such student is using the transport facility.') . '</strong></td></tr>'; } else { foreach ($list as $list_1) { $student = Students::model()->findByAttributes(array('id' => $list_1->student_id)); $stopdetails = StopDetails::model()->findByAttributes(array('id' => $list_1->stop_id)); $routedetails = RouteDetails::model()->findByAttributes(array('id' => $stopdetails->route_id)); ?> <tr> <td align="center"><?php echo $student->last_name . ' ' . $student->first_name; ?> </td> <td align="center"><?php echo $routedetails->route_name; ?> </td> <td align="center"><?php echo $stopdetails->stop_name; ?> </td>