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));
 }
Beispiel #3
0
    ?>
</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>
Beispiel #4
0
 ?>
             <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') . '&nbsp;-&nbsp;';
 foreach ($allot as $allot_1) {
     $data = Allotment::model()->findAllByAttributes(array('room_no' => $allot_1->room_no, 'status' => 'C'));
     echo $allot_1->bed_no . '&nbsp;&nbsp; ';
 }
 ?>
                 </td>
                <td align="center">
                <?php 
 echo count($data) . '/' . count($allot);
 ?>
                </td>
                 
                     <?php 
 /*?><?php if($list_1->status=='C')
 	{
 		echo '<td align="center">Yes</td>';
 	}
Beispiel #5
0
	<?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>&nbsp;</td>
    <td><?php 
Beispiel #6
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 = 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));
 }
Beispiel #8
0
$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>
Beispiel #9
0
                ?>
</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;
                            ?>
 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));
     }
 }
Beispiel #11
0
<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>&nbsp;</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));
     }
 }
Beispiel #13
0
?>
<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 . '&nbsp;<strong>' . ucfirst($student->first_name . ' ' . $student->last_name) . '&nbsp;has been requested for changing room to' . ' ' . $allot->room_no . '&nbsp;' . $allot->bed_no . ' ' . '</strong>[&nbsp;' . CHtml::link(Yii::t('hostel', 'Allot'), array('/hostel/allotment/create', 'studentid' => $request_1->student_id, 'allotid' => $request_1->allot_id)) . '&nbsp;]<br>';
                $i++;
            }
        } else {
            if ($request_1->allot_id == NULL) {
                $i = 1;
                if ($student != NULL) {
                    echo $i . '&nbsp;<strong>' . ucfirst($student->first_name . ' ' . $student->last_name) . '&nbsp;has been applied for hostel facility</strong>&nbsp;' . CHtml::link(Yii::t('hostel', 'Register'), array('/hostel/registration/update', 'studentid' => $request_1->student_id, 'id' => $reg->id));
                    $i++;
                }
Beispiel #15
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>
    <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();
Beispiel #16
0
 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;
 }