public function actiongetBlock() { $div = array(); $result = HostelBlocks::model()->findAll('block_hostel_id = ' . (int) $_REQUEST['HostelRoomMaster']['hostel_hostelinfo_id']); $data = CHtml::listData($result, 'block_id', 'block_name'); $div .= "<option value=''>Select Block</option>"; foreach ($data as $value => $name) { $div .= CHtml::tag('option', array('value' => $value), CHtml::encode($name), true); } echo CJSON::encode(array('div' => $div)); }
else{ $roomAllocation = Yii::app()->db->createCommand() ->select('*') ->from('hostel_room_master') ->where('hostel_hostelinfo_id = '.$hostelid. ' and hostel_block_id = '.$blockid) ->queryAll(); } foreach($roomAllocation as $key=>$data){ $reg_data = HostelStudentRegistration::model()->findAll(array('condition'=>'hostel_room_id='.$data['hostel_room_master_id'])); $rowspan=count($reg_data); if($blockid) echo "<td rowspan=".$rowspan. ">". HostelBlocks::model()->findByPk($blockid)->block_name ."</ td>"; else echo "<td rowspan=".$rowspan.">".HostelBlocks::model()->findByPk($data['hostel_block_id'])->block_name."</td>"; echo "<td rowspan=".$rowspan.">". $data['hostel_room_no_or_name'] ."</td>"; echo "<td rowspan=".$rowspan.">". $data['hostel_room_capacity'] ."</td>"; if($reg_data){ foreach($reg_data as $key=>$val){ $stud_trans = StudentTransaction::model()->findByPk($val['hostel_student_transaction_id']); echo "<td >". StudentInfo::model()->findByPk($stud_trans->student_transaction_student_id)->student_first_name ."</td>"; echo "<td >". Branch::model()->findByPk($stud_trans->student_transaction_branch_id)->branch_name ."</td>"; echo "<td>". AcademicTermPeriod::model()->findByPk($stud_trans->student_academic_term_period_tran_id)->academic_term_period ."</td>"; echo "<td >". AcademicTerm::model()->findByPk($stud_trans->student_academic_term_name_id)->academic_term_name ."</td>"; echo "</tr>"; } } else{