public function actionDeleteall($id) { $hostel = Hosteldetails::model()->findByAttributes(array('id' => $id)); $hostel->is_deleted = '1'; $hostel->save(); $floor = Floor::model()->findAllByAttributes(array('hostel_id' => $id)); foreach ($floor as $floor1) { $room = Room::model()->findAllByAttributes(array('floor' => $floor1->id)); foreach ($room as $room1) { $allot = Allotment::model()->findAllByAttributes(array('room_no' => $room1->id)); foreach ($allot as $allot1) { $allot1->delete(); $floor1->delete(); $room1->delete(); } } } $this->redirect(array('manage')); }
/** * 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)); }
<?php echo $form->errorSummary($model); if (Yii::app()->controller->action->id == 'create') { $bed_no_1 = ''; $floor_no = ''; if (isset($_REQUEST['studentid']) && !isset($_REQUEST['allotid'])) { $bed_no = Allotment::model()->findAll('status=:x ORDER BY id ASC', array(':x' => 'C')); if ($bed_no == NULL) { $bed_no_1 = ''; $floor_no = ''; } else { $bed_no_1 = $bed_no[0]['bed_no']; } } else { if (isset($_REQUEST['studentid']) && isset($_REQUEST['allotid'])) { $room = Allotment::model()->findByAttributes(array('id' => $_REQUEST['allotid'])); $bed_no_1 = $room->bed_no; } } } ?> <div class="formCon" > <div class="formConInner"> <table width="80%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php echo $form->labelEx($model, Yii::t('hostel', 'Bed no')); ?> </td> <td> </td> <td><?php
/** * 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 = Allotment::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $reg = Registration::model()->findByAttributes(array('student_id' => $_REQUEST['studentid'])); $student = Students::model()->findByAttributes(array('id' => $_REQUEST['studentid'])); $model->student_id = $student->first_name . ' ' . $student->last_name; $model->food_preference = $reg->food_preference; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Registration'])) { $model->attributes = $_POST['Registration']; $model->student_id = $_REQUEST['studentid']; $register = Registration::model()->findByAttributes(array('student_id' => $_REQUEST['studentid'])); if ($register != NULL) { $request = Roomrequest::model()->findByAttributes(array('student_id' => $register->student_id, 'status' => 'C')); if ($request != NULL) { $request->status = 'S'; $request->save(); } $model->status = 'S'; $register->save(); } if ($model->save()) { $bed_info = Allotment::model()->findAll('status=:x AND student_id IS NULL', array(':x' => 'C')); if ($bed_info == NULL) { $this->redirect(array('/hostel/allotment/roominfo/')); } else { $this->redirect(array('/hostel/room/roomlist', 'id' => $model->student_id, 'floor_id' => $_POST['floor'])); } } } $this->render('update', array('model' => $model)); }
$form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'refund-form', 'enableAjaxValidation' => false, 'type' => 'horizontal')); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListGroup($model, 'applicant_id', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 10), 'data' => Applicant::getApplicantOptions()))); ?> <?php echo $form->dropDownListGroup($model, 'allotment_id', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 10), 'data' => Allotment::getAllotmentOptions()))); ?> <?php echo $form->textFieldGroup($model, 'amount', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 10)))); ?> <?php echo $form->datePickerGroup($model, 'date', array('widgetOptions' => array('options' => array('format' => Yii::app()->user->getDateFormat(true), 'autoclose' => true), 'htmlOptions' => array('class' => 'span5')), 'prepend' => '<i class="glyphicon glyphicon-calendar"></i>', 'append' => 'Click on Month/Year to select a different Month/Year.')); ?> <?php echo $form->datePickerGroup($model, 'date_applied', array('widgetOptions' => array('options' => array('format' => Yii::app()->user->getDateFormat(true), 'autoclose' => true), 'htmlOptions' => array('class' => 'span5')), 'prepend' => '<i class="glyphicon glyphicon-calendar"></i>', 'append' => 'Click on Month/Year to select a different Month/Year.')); ?> <div class="form-actions text-center">
$this->breadcrumbs = array('Rooms' => array('/hostel'), 'change'); ?> <div id="parent_Sect"> <?php $this->renderPartial('/settings/studentleft'); ?> <div id="parent_rightSect"> <div class="parentright_innercon"> <h1>Room</h1> <div class="profile_details"> <?php $data = Allotment::model()->findByAttributes(array('student_id' => $_REQUEST['studentid'])); $student = Students::model()->findByAttributes(array('id' => $_REQUEST['studentid'])); echo 'Your request for room change has been submitted'; ?> </div> </div> <div class="clear"></div> </div> <div class="clear"></div> </div>
public function getCurrentAllottee() { $result = Allotment::model()->findByPk($this->id); if ($this->latest_transfer) { $result->applicant_id = $this->latest_transfer->transfer_to->id; $result->date = $this->latest_transfer->transfer_date; $result->order_no = $this->latest_transfer->deed_no; $result->type = 'transfer'; $result->_transfer_id = $this->latest_transfer->id; } return $result; }
public function actionRoomvacate() { $model = new Vacate(); if (isset($_POST['search'])) { $criteria = new CDbCriteria(); if (isset($_POST['student_id']) and $_POST['student_id'] != NULL) { $criteria->condition = 'student_id = :match'; $criteria->params = array(':match' => $_POST['student_id']); } $total = Allotment::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(Yii::app()->params['listPerPage']); $pages->applyLimit($criteria); // the trick is here! $posts = Allotment::model()->findAll($criteria); $this->render('roomvacate', array('model' => $model, 'list' => $posts, 'pages' => $pages, 'item_count' => $total, 'page_size' => Yii::app()->params['listPerPage'])); } else { $this->render('roomvacate', array('model' => $model)); } }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'vacate-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); if (Yii::app()->controller->action->id == 'create') { $student_details = Allotment::model()->findByAttributes(array('student_id' => $_REQUEST['id'], 'status' => 'S')); $room = Room::model()->findByAttributes(array('id' => $student_details->room_no)); } ?> <div class="formCon" > <div class="formConInner"> <table width="80%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php //echo $form->labelEx($model,'Student'); ?> </td> <td> </td> <td><?php echo $form->hiddenField($model, 'student_id', array('size' => 20, 'value' => $student_details->student_id)); ?> <?php echo $form->error($model, 'student_id'); ?> </td>
public function actionRoomsearch() { $model = new Allotment(); if (isset($_POST['search'])) { $criteria = new CDbCriteria(); $i = 1; if (isset($_POST['student_id']) and $_POST['student_id'] != NULL) { $criteria->condition = 'student_id LIKE :match'; $criteria->params[':match'] = $_POST['student_id']; $i = 0; } //if(isset($_POST['Allotment']['floor']) and $_POST['Allotment']['floor']!=NULL) //{ //$room=Room::model()->findByAttributes(array('floor'=>$_POST['Allotment']['floor'])); //if($i==0) // { // $criteria->condition=$criteria->condition.' and floor LIKE :match1'; // } // else // { /// $criteria->condition='floor LIKE :match1'; // } // $criteria->params[':match1'] = $room->floor.'%'; // $i=0; //} if (isset($_POST['Allotment']['room_no']) and $_POST['Allotment']['room_no'] != NULL) { if ($i == 0) { $criteria->condition = $criteria->condition . ' and room_no LIKE :match2'; } else { $criteria->condition = 'room_no LIKE :match2'; } $criteria->params[':match2'] = $_POST['Allotment']['room_no']; //$criteria->params = array(':match2'=>$_POST['Allotment']['room_no'].'%',':x'=>'S'); } $total = Allotment::model()->count($criteria); $pages = new CPagination($total); $pages->setPageSize(Yii::app()->params['listPerPage']); $pages->applyLimit($criteria); // the trick is here! $posts = Allotment::model()->findAll($criteria); $this->render('roomsearch', array('model' => $model, 'list' => $posts, 'pages' => $pages, 'item_count' => $total, 'page_size' => Yii::app()->params['listPerPage'])); } else { $this->render('roomsearch', array('model' => $model)); } }
?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="247" valign="top"> <?php $this->renderPartial('/settings/hostel_left'); ?> </td> <td valign="top"> <div class="cont_right"> <h1><?php echo Yii::t('hostel', 'Student Details'); ?> </h1> <?php $allot = Allotment::model()->findByAttributes(array('student_id' => $studentid, 'status' => 'S')); if ($allot != NULL) { $stud = Students::model()->findByAttributes(array('id' => $allot->student_id)); $register = Registration::model()->findByAttributes(array('student_id' => $allot->student_id)); $food = FoodInfo::model()->findByAttributes(array('id' => $register->food_preference)); $mess = MessFee::model()->findByAttributes(array('student_id' => $allot->student_id)); $floor = Floor::model()->findByAttributes(array('id' => $allot->floor)); $hostel = Hosteldetails::model()->findByAttributes(array('id' => $floor->hostel_id)); ?> <div class="pdtab_Con" style="padding:0px;"> <table width="100%" cellpadding="0" cellspacing="0" border="0" > <tr class="pdtab-h"> <td align="center"><?php echo Yii::t('hostel', 'Student Name'); ?> </td>
<div class="y_bx_head" style="width:90%"> <h1><?php echo Yii::t('hostel', 'Notifications'); ?> </h1> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <?php $request = Roomrequest::model()->findAll('status=:x order by created_at DESC limit 1', array(':x' => 'C')); if ($request != NULL) { $i = 1; foreach ($request as $request_1) { echo '<tr>'; $student = Students::model()->findByAttributes(array('id' => $request_1->student_id)); $reg = Registration::model()->findByAttributes(array('student_id' => $request_1->student_id)); if ($request_1->allot_id != NULL) { $allot = Allotment::model()->findByAttributes(array('id' => $request_1->allot_id)); if ($student != NULL) { echo '<td align="center">' . $i . '</td>'; echo '<td align="center"><strong>' . ucfirst($student->last_name . ' ' . $student->first_name) . '</td>'; echo '<td align="center">' . $i . '</td>'; echo '<td align="center">' . $i . '</td>'; echo $i . ' <strong>' . ucfirst($student->first_name . ' ' . $student->last_name) . ' has been requested for changing room to' . ' ' . $allot->room_no . ' ' . $allot->bed_no . ' ' . '</strong>[ ' . CHtml::link(Yii::t('hostel', 'Allot'), array('/hostel/allotment/create', 'studentid' => $request_1->student_id, 'allotid' => $request_1->allot_id)) . ' ]<br>'; $i++; } } else { if ($request_1->allot_id == NULL) { $i = 1; if ($student != NULL) { echo $i . ' <strong>' . ucfirst($student->first_name . ' ' . $student->last_name) . ' has been applied for hostel facility</strong> ' . CHtml::link(Yii::t('hostel', 'Register'), array('/hostel/registration/update', 'studentid' => $request_1->student_id, 'id' => $reg->id)); $i++; }
<tr> <td width="247" valign="top"> <?php $this->renderPartial('/settings/hostel_left'); ?> </td> <td valign="top"> <div class="cont_right"> <h1><?php echo Yii::t('hostel', 'Student Details'); ?> </h1> <div class="formCon" > <div class="formConInner"> <table width="50%" border="0" cellspacing="0" cellpadding="0"> <tr> <?php echo '<td><strong>' . CHtml::label(Yii::t('hostel', 'Student ID'), '') . '</strong></td><td>'; echo CHtml::dropDownList('studentid', '', CHtml::listData(Allotment::model()->findAll('status=:x', array(':x' => 'S')), 'student_id', 'studentadm'), array('prompt' => 'Select', 'id' => 'student_id', 'submit' => array('MessManage/messdetails'))) . '</td>'; ?> </tr> </table> </div> </div> </div> </td> </tr> </table> <?php $this->endWidget();
public function hotelDetail() { if (Input::has('hotel_id')) { $hotel_id = Input::get('hotel_id'); Session::put('hotel_id', $hotel_id); } else { $hotel_id = Session::get('hotel_id'); } if (Session::has('market')) { $market = Session::get('market'); } $st_date = Session::get('st_date'); $ed_date = Session::get('ed_date'); $date_ed = new DateTime(Session::get('ed_date')); $date_st = new DateTime(Session::get('st_date')); $date_difference = $date_ed->diff($date_st); $date_gap = $date_difference->d; Session::put('date_gap', $date_gap); if (Input::has('room_type')) { $room_type = Input::get('room_type'); Session::put('filter_room_type', $room_type); $meal_basis = Session::get('filter_meal_type'); } else { $room_type = Session::get('room_type'); } if (Input::has('meal_type')) { $meal_basis = Input::get('meal_type'); Session::put('filter_meal_type', $meal_basis); $room_type = Session::get('filter_room_type'); } else { $meal_basis = Session::get('meal_basis'); } //dd($meal_basis.'/'.$room_type); $from_date = date('Y-m-d', strtotime(str_replace('-', '/', $st_date))); $to_date = date('Y-m-d', strtotime(str_replace('-', '/', $ed_date))); $path = array(); $directory = public_path() . '/images/hotel_images/'; $images = glob($directory . $hotel_id . "_" . "*.*"); foreach ($images as $image) { $path[] = $image; } //dd($hotel_id); $hotel_name = Hotel::Where('id', $hotel_id)->first()->name; $get_rooms = DB::table('rates')->select('rates.id as rate_id', 'rates.from', 'rates.to', 'rates.rate', 'hotels.id as hotel_id', 'hotels.name as hotel_name', 'hotels.star_category_id', 'hotels..city_id', 'meal_bases.id as meal_basis_id', 'meal_bases.meal_basis', 'meal_bases.meal_basis_name', 'room_types.id as room_type_id', 'room_types.room_type', 'room_specifications.id as room_specification_id', 'room_specifications.room_specification')->join('hotels', 'hotels.id', '=', 'rates.hotel_id')->join('meal_bases', 'meal_bases.id', '=', 'rates.meal_basis_id')->join('room_types', 'room_types.id', '=', 'rates.room_type_id')->join('room_specifications', 'room_specifications.id', '=', 'rates.room_specification_id')->where('rates.val', 1)->where('rates.hotel_id', $hotel_id)->where('rates.room_specification_id', 'LIKE', $room_type)->where('rates.meal_basis_id', 'LIKE', $meal_basis)->where('rates.from', '<=', $from_date)->where('rates.to', '>', $from_date)->get(); // dd(count($get_rooms)); if (!empty($get_rooms)) { foreach ($get_rooms as $room) { $hotel_id = $room->hotel_id; $room_type_id = $room->room_type_id; $room_specification_id = $room->room_specification_id; $meal_basis_id = $room->meal_basis_id; $room_type = $room->room_type; $meal_basis = $room->meal_basis; $room_specification = $room->room_specification; //dd($room_type_id.'/'.$room_specification_id.'/'.$meal_basis_id); $get_low_hotel_rate = Rate::lowestRoomRateWithTax($hotel_id, $room_type_id, $room_specification_id, $meal_basis_id, $st_date, $ed_date); if ($get_low_hotel_rate > 0) { $low_room_rate = $get_low_hotel_rate; } else { $low_room_rate = 0; } $allotments = Allotment::allotmentsCount($room_type_id, Session::get('st_date'), Session::get('ed_date')); $room_array = array('hotel_id' => $hotel_id, 'room_type_id' => $room_type_id, 'room_specification_id' => $room_specification_id, 'meal_basis_id' => $meal_basis_id, 'room_type' => $room_type, 'meal_basis' => $meal_basis, 'room_specification' => $room_specification, 'low_room_rate' => $low_room_rate, 'allotments' => $allotments); $rooms[] = $room_array; //array_push($rooms, $room_array); array_merge($rooms, $room_array); // dd(count($get_rooms)); } } else { return null; } return Response::json(array('hotel_name' => $hotel_name, 'rooms' => $rooms)); // }
?> <tr> <td align="center"> <?php echo $hostel->hostel_name; ?> <td align="center"> <?php echo $floor->floor_no; ?> </td> <td align="center"> <?php echo $list_1->room_no . '<br>' . Yii::t('hostel', 'Beds') . ' - '; foreach ($allot as $allot_1) { $data = Allotment::model()->findAllByAttributes(array('room_no' => $allot_1->room_no, 'status' => 'C')); echo $allot_1->bed_no . ' '; } ?> </td> <td align="center"> <?php echo count($data) . '/' . count($allot); ?> </td> <?php /*?><?php if($list_1->status=='C') { echo '<td align="center">Yes</td>'; }
?> </td> <td align="center"><?php echo Yii::t('hostel', 'Bed'); ?> </td> <td align="center"><?php echo Yii::t('hostel', 'Action'); ?> </td> </tr> <?php if ($room != NULL) { foreach ($room as $room_1) { $list = Allotment::model()->findAllByAttributes(array('room_no' => $room_1->id, 'status' => 'C')); foreach ($list as $list_1) { ?> <tr> <td align="center"><?php echo $floordetails->floor_no; ?> </td> <td align="center"><?php echo $list_1->room_no; ?> </td> <td align="center"><?php echo $list_1->bed_no; ?> </td>
?> </td> <td align="center"><?php echo Yii::t('hostel', 'Bed'); ?> </td> <td align="center"><?php echo Yii::t('hostel', 'Action'); ?> </td> </tr> <?php foreach ($list as $list_1) { $floordetails = Floor::model()->findByAttributes(array('id' => $list_1->floor)); $allot = Allotment::model()->findAll('room_no=:x and status=:y', array(':x' => $list_1->id, ':y' => 'C')); if ($allot != NULL) { foreach ($allot as $allot_1) { ?> <tr> <td align="center"><?php echo $floordetails->floor_no; ?> </td> <td align="center"><?php echo $allot_1->room_no; ?> </td> <td align="center"><?php echo $allot_1->bed_no; ?>