public function actionIndex()
 {
     $model = new Admission();
     $location_list = array();
     $location = AdmissionLocation::model()->findAll();
     foreach ($location as $locate) {
         $location_list[$locate->location_id] = $locate->name;
     }
     $program_list = array();
     $programs = AdmissionProgram::model()->findAll();
     foreach ($programs as $pro) {
         $program_list[$pro->program_id] = $pro->name;
     }
     if (isset($_POST['Admission'])) {
         list($d, $m, $y) = explode("/", $_POST['Admission']['birthday']);
         $birthday = $y - 543 . "-" . $m . "-" . $d;
         $_POST['Admission']['birthday'] = $birthday;
         $model->attributes = $_POST['Admission'];
         if ($model->save()) {
             Yii::app()->user->setFlash('admission', 'ส่งใบสมัครเรียนออนไลน์เรียบร้อยแล้ว ทางเราจะติดต่อกลับไปในภายหลัง ขอบคุณค่ะ');
             $this->refresh();
             //$this->redirect(array('index'));
         }
     }
     $this->render('index', array('model' => $model, 'location_list' => $location_list, 'program_list' => $program_list));
 }
示例#2
0
	<div class="row">
		<?php 
echo $form->label($model, 'admission_id');
?>
		<?php 
echo $form->textField($model, 'admission_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'location_id');
?>
                <?php 
echo $form->dropDownList($model, 'location_id', CHtml::listData(AdmissionLocation::model()->findAll(), 'location_id', 'name'), array('prompt' => '------------ กรุณาเลือกสถานที่เรียน ------------'));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'program_id');
?>
                <?php 
echo $form->dropDownList($model, 'program_id', CHtml::listData(AdmissionProgram::model()->findAll(), 'program_id', 'name'), array('prompt' => '------------ กรุณาเลือกสาขา ------------'));
?>
	</div>
    
	<div class="row">
		<?php 
echo $form->label($model, 'title');
示例#3
0
<?php

/* @var $this AdmissionController */
/* @var $model Admission */
$this->breadcrumbs = array('สมัครเรียนออนไลน์' => array('index'), 'จัดการข้อมูล');
$this->menu = array();
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#admission-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>สมัครเรียนออนไลน์</h1>

<?php 
echo CHtml::link('ค้นหาแบบละเอียด', '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'admission-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'admission_id', 'htmlOptions' => array('style' => 'text-align: center;width: 30px;')), array('name' => 'title', 'htmlOptions' => array('style' => 'text-align: center;width: 70px;'), 'filter' => array('1' => 'นาย', '2' => 'นาง', '3' => 'นางสาว', '4' => 'ยศ.')), array('name' => 'firstname_th', 'header' => 'ชื่อ(ไทย)', 'htmlOptions' => array('style' => 'text-align: left;width: 80px;')), array('name' => 'lastname_th', 'header' => 'นามสกุล(ไทย)', 'htmlOptions' => array('style' => 'text-align: left;width: 100px;')), array('name' => 'location_id', 'header' => 'สถานที่เรียน', 'value' => '$data->location->name', 'htmlOptions' => array('style' => 'text-align: left;width: 120px;'), 'filter' => CHtml::listData(AdmissionProgram::model()->findAll(), 'location_id', 'name')), array('name' => 'program_id', 'header' => 'สาขาที่สมัคร', 'value' => '$data->program->name', 'filter' => CHtml::listData(AdmissionLocation::model()->findAll(), 'program_id', 'name')), array('class' => 'CButtonColumn', 'template' => '{view}&nbsp;&nbsp;{delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));