public function actionType()
 {
     $group = !empty($_POST['group']) ? $_POST['group'] : '';
     $data = CooperationType::model()->findAll('t.group=:group', array(':group' => $group));
     $data = CHtml::listData($data, 'co_type_id', 'name_th');
     foreach ($data as $value => $name_th) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name_th), true);
     }
 }
Example #2
0
<?php

$lang = Yii::app()->language;
$type = CooperationType::model()->findByPk($_GET['type_id']);
if ($lang == 'en' || $lang == 'EN' || $lang == 'En') {
    if ($type->group == 'inbound') {
        $group = "Domestic";
    } else {
        $group = "International";
    }
    $this->pageTitle = 'Graduate School of Public Administration - Cooperation';
    if ($_GET['type_id']) {
        $this->breadcrumbs = array('About GSPA' => array('about/index', 'id' => '1'), 'Cooperation' => array('index'), $group => array($type->group), $type->name_en);
    } else {
        $this->breadcrumbs = array('About GSPA' => array('about/index', 'id' => '1'), 'Cooperation');
    }
    $header = "Cooperation";
} else {
    $this->pageTitle = Yii::app()->name . ' - ความร่วมมือ';
    if ($type->group == 'inbound') {
        $group = "ภายในประเทศ";
    } else {
        $group = "ต่างประเทศ";
    }
    if ($_GET['type_id']) {
        $this->breadcrumbs = array('เกี่ยวกับหน่วยงาน' => array('about/index', 'id' => '1'), 'ความร่วมมือ' => array('index'), $group => array($type->group), $type->name_th);
    } else {
        $this->breadcrumbs = array('เกี่ยวกับหน่วยงาน' => array('about/index', 'id' => '1'), 'ความร่วมมือ');
    }
    $header = "ความร่วมมือ";
}
 /**
  * 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 $id the ID of the model to be loaded
  * @return CooperationType the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CooperationType::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #4
0
<?php

/* @var $this CooperationController */
/* @var $model Cooperation */
$this->breadcrumbs = array('ความร่วมมือ' => array('index'), 'จัดการข้อมูล');
$this->menu = array(array('label' => 'เพิ่มข้อมูล', 'url' => array('create')), array('label' => 'เรียงลำดับข้อมูล', 'url' => array('order')));
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\$('#cooperation-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, 'co_type_list' => $co_type_list));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'cooperation-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'co_id', 'htmlOptions' => array('style' => 'text-align: center;width: 30px;')), array('name' => 'name_th', 'header' => 'ชื่อเรื่อง', 'htmlOptions' => array('style' => 'text-align: left;')), array('name' => 'co_type_id', 'header' => 'ประเภทความร่วมมือ', 'value' => '$data->coType->name_th', 'htmlOptions' => array('style' => 'text-align: left;width: 150px;'), 'filter' => CHtml::listData(CooperationType::model()->findAll('status=1'), 'co_type_id', 'name_th')), array('name' => 'group', 'header' => 'กลุ่มความร่วมมือ', 'value' => '($data->group==\'inbound\')? \'ในประเทศ\' : \'ต่างประเทศ\'', 'htmlOptions' => array('style' => 'text-align: left;width: 90px;'), 'filter' => array('inbound' => 'ในประเทศ', 'outbound' => 'ต่างประเทศ')), array('name' => 'status', 'value' => '($data->status)? \'แสดง\' : \'ไม่แสดง\'', 'htmlOptions' => array('style' => 'text-align: center;width: 50px;'), 'filter' => array('1' => 'แสดง', '0' => 'ไม่แสดง')), array('class' => 'CButtonColumn', 'template' => '{update}&nbsp;&nbsp;{delete}', 'headerHtmlOptions' => array('style' => 'width:40px;'), 'htmlOptions' => array('style' => 'width:40px; text-align:center')))));
Example #5
0
        echo $type->name_th;
        ?>
</a></li>        
        <?php 
    }
    ?>
        <li><h6><a href="<?php 
    echo Yii::app()->createUrl('cooperation/outbound');
    ?>
">ต่างประเทศ</a></h6></li>
        <?php 
    $criteria = new CDbCriteria();
    $criteria->condition = 'status=:status AND t.group=:group';
    $criteria->params = array(':status' => 1, ':group' => 'outbound');
    $criteria->order = 'sort_order';
    $co_type = CooperationType::model()->findAll($criteria);
    foreach ($co_type as $type) {
        ?>
        <li><a href="<?php 
        echo Yii::app()->createUrl('cooperation', array('type_id' => $type->co_type_id));
        ?>
"><img src="<?php 
        echo Yii::app()->request->baseUrl;
        ?>
/images/front/marker_2.gif" border="0" style="padding-top: 7px"/>&nbsp;<?php 
        echo $type->name_th;
        ?>
</a></li>        
        <?php 
    }
    ?>