public function actionIndex()
 {
     $departments = Departments::find()->all();
     Yii::$app->view->title = 'Xem chương trình đào tạo các ngành';
     Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => 'Bluebee-UET.com - Chương trình đào tạo chuẩn UET']);
     Yii::$app->view->registerMetaTag(['property' => 'og:title', 'content' => 'Bluebee-UET.com - Chương trình đào tạo chuẩn UET']);
     Yii::$app->view->registerMetaTag(['property' => 'og:description', 'content' => 'Bluebee-UET.com - Chương trình đào tạo chuẩn UET']);
     Yii::$app->view->registerMetaTag(['property' => 'og:image', 'content' => 'http://bluebee-uet.com/img/logo.jpg']);
     return $this->render('list', ['departments' => $departments]);
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Departments::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Departments::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->joinWith('companiesCompany');
     $query->joinWith('branchesBranch');
     $query->andFilterWhere(['department_id' => $this->department_id, 'department_created_date' => $this->department_created_date]);
     $query->andFilterWhere(['like', 'department_name', $this->department_name])->andFilterWhere(['like', 'department_status', $this->department_status])->andFilterWhere(['like', 'companies.company_name', $this->companies_company_id])->andFilterWhere(['like', 'branches.branch_name', $this->branches_branch_id]);
     return $dataProvider;
 }
Exemple #4
0
echo $form->field($model, 'tumbon')->widget(DepDrop::className(), ['data' => $tum, 'options' => ['placeholder' => '<--คลิกเลือกตำบล-->'], 'type' => DepDrop::TYPE_SELECT2, 'select2Options' => ['pluginOptions' => ['allowClear' => true]], 'pluginOptions' => ['depends' => ['employees-chw', 'employees-ampur'], 'url' => yii\helpers\Url::to(['/employees/get-dist']), 'loadingText' => 'กำลังค้นข้อมูล...']]);
?>
        </div>
        <div class="col-xs-3 col-sm-3 col-md-3">
            <?php 
echo $form->field($model, 'tel')->widget(\yii\widgets\MaskedInput::classname(), ['mask' => '999-999-9999']);
?>
        </div>
        <div class="col-xs-3 col-sm-3 col-md-3">            
            <?php 
echo $form->field($model, 'comein')->widget(DatePicker::className(), ['language' => 'th', 'dateFormat' => 'yyyy-MM-dd', 'clientOptions' => ['changeMonth' => true, 'changeYear' => true], 'options' => ['class' => 'form-control']]);
?>
        </div>
        <div class="col-xs-3 col-sm-3 col-md-3">            
            <?php 
echo $form->field($model, 'department_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Departments::find()->all(), 'id', 'name'), 'language' => 'th', 'options' => ['placeholder' => 'เลือกแผนก ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
        </div>
        <div class="col-xs-3 col-sm-3 col-md-3">
             <?php 
echo $form->field($model, 'education')->dropDownList(['ปริณญาตรี' => 'ปริณญาตรี', 'ปริณญาโท' => 'ปริณญาโท', 'สูงกว่าระดับปริณญาโทขึ้นไป' => 'สูงกว่าระดับปริณญาโทขึ้นไป', 'ปวส/อนุปริณญา' => 'ปวส/อนุปริณญา', 'มัธยมศึกษา6' => 'มัธยมศึกษา6', 'มัธยมศึกษา3' => 'มัธยมศึกษา3', 'ประถมศึกษา' => 'ประถมศึกษา'], ['prompt' => '']);
?>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-6 col-sm-6col-md-6">
            <?php 
echo $form->field($model, 'ability')->checkboxList(app\models\Employees::itemAlias('ability'));
?>
        </div>
    </div>
Exemple #5
0
 public static function getTeachersByDepartment($department)
 {
     $query = Teachers::find()->where(['department' => $department])->orderBy('id desc');
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     $pages->defaultPageSize = 27;
     $models = $query->offset($pages->offset)->limit($pages->limit)->all();
     if (!Yii::$app->cache->exists('departments')) {
         $departments = Departments::find()->orderBy('name', 'desc')->all();
         Yii::$app->cache->add('departments', $departments, 3600);
     } else {
         $departments = Yii::$app->cache->get('departments');
     }
     return ['models' => $models, 'pages' => $pages, 'departments' => $departments];
 }
Exemple #6
0
<div class="offices-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name_th')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'email')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'department_id')->dropDownList(ArrayHelper::map(Departments::find()->where('status="1"')->all(), 'id', 'name'), ['prompt' => '--เลือกสังกัด--']);
?>

    <?php 
echo $form->field($model, 'address')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'position')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(['0' => 'ไม่ใช้งาน', '1' => 'ใช้งาน'], ['prompt' => '--เลือกสถานะ--']);
?>

    <?php 
Exemple #7
0
 public static function getDepartments()
 {
     if (!Yii::$app->cache->exists('subjects')) {
         $departments = Departments::find()->orderBy('name')->all();
         Yii::$app->cache->add('departments', $departments, 3600);
     } else {
         $departments = Yii::$app->cache->get('departments');
     }
     return $departments;
 }
Exemple #8
0
 public static function getByid($input)
 {
     $query = Departments::find();
     $data = $query->where($input)->asArray()->all();
     return $data;
 }