Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Comactivities::find()->orderBy(['id' => SORT_DESC]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'section_id' => $this->section_id, 'equipment_id' => $this->equipment_id, 'datetime' => $this->datetime, 'act_process' => $this->act_process, 'mod' => $this->mod, 'savedate' => $this->savedate, 'result' => $this->result]);
     $query->andFilterWhere(['like', 'act_detail', $this->act_detail])->andFilterWhere(['like', 'images', $this->images]);
     return $dataProvider;
 }
Esempio n. 2
0
File: index.php Progetto: poykub/wph
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'บันทึกข้อมูลการปฏิบัติงานคอมพิวเตอร์';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="comactivities-index">

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('บันทึกข้อมูลใหม่', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    <?php 
$columns = ['id', ['attribute' => 'section_id', 'width' => '220px', 'value' => function ($data) {
    if (isset($data->section_role->section_desc)) {
        return $data->section_role->section_desc;
    } else {
        return 'ไม่ทราบข้อมูล';
        //
    }
}, 'filter' => \yii\helpers\ArrayHelper::map(app\models\Section::find()->all(), 'id', 'section_desc')], ['attribute' => 'equipment_id', 'width' => '160px', 'filter' => \app\models\Comactivities::itemsAlias('equipment'), 'value' => function ($model) {
    return $model->EquipmentName;
}], 'act_detail:ntext', ['attribute' => 'datetime', 'filterType' => GridView::FILTER_DATE, 'format' => 'raw', 'width' => '220px', 'format' => 'html', 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'yyyy-mm-dd', 'language' => 'th']]], ['class' => 'kartik\\grid\\BooleanColumn', 'attribute' => 'result', 'vAlign' => 'middle'], ['class' => 'kartik\\grid\\ActionColumn', 'dropdown' => false, 'order' => DynaGrid::ORDER_FIX_RIGHT], ['class' => 'kartik\\grid\\CheckboxColumn', 'order' => DynaGrid::ORDER_FIX_RIGHT]];
echo DynaGrid::widget(['columns' => $columns, 'storage' => DynaGrid::TYPE_SESSION, 'theme' => 'panel-info', 'gridOptions' => ['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'hover' => true, 'panel' => ['heading' => '<h3 class="panel-title">รายการปฏิบัติงานคอมพิวเตอร์</h3>', 'before' => '{dynagrid}', 'defaultPageSize' => 20]], 'options' => ['id' => 'dynagrid-1']]);
?>

</div>
Esempio n. 3
0
 public function getComactivities()
 {
     return $this->hasMany(Comactivities::className(), ['section_id' => 'id']);
 }
Esempio n. 4
0
 /**
  * Finds the Comactivities model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Comactivities the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Comactivities::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }