Example #1
0
 public function actionPutDepartments()
 {
     $data = Yii::$app->request->post();
     Departments::setDepartments($data);
     $result = Departments::getAll();
     print_r(json_encode($result));
     return false;
 }
Example #2
0
 public function actionSuggest()
 {
     $request = Yii::$app->request;
     $department_id = $request->get('id');
     $department_name = Departments::findOne(['id' => $department_id])->name;
     Yii::$app->view->title = 'Chương trình đào tạo ngành: ' . $department_name;
     Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => 'Bluebee-UET.com - Chương trình đào tạo ngành: ' . $department_name]);
     Yii::$app->view->registerMetaTag(['property' => 'og:title', 'content' => 'Bluebee-UET.com - Chương trình đào tạo ngành: ' . $department_name]);
     Yii::$app->view->registerMetaTag(['property' => 'og:description', 'content' => 'Bluebee-UET.com - Chương trình đào tạo ngành: ' . $department_name]);
     Yii::$app->view->registerMetaTag(['property' => 'og:image', 'content' => 'http://bluebee-uet.com/img/logo.jpg']);
     return $this->render('index', ['department_name' => $department_name, 'department_id' => $department_id]);
 }
 /**
  * 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;
 }
Example #4
0
 public function actionFormSubmission($id = null)
 {
     $data = Yii::$app->request->post();
     if (isset($data['type'])) {
         Payments::addPayments($data, $id);
     }
     $searchModel = new Payments();
     $expenses = Expenses::getByid(['id' => $id]);
     $departments = Departments::getByid(['id' => $expenses[0]['iddepartment']]);
     $params = ['idexpense' => $id];
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $params);
     $breadcrumbs[] = ['label' => $departments[0]['name'], 'url' => ['/department/' . $departments[0]['id']]];
     $breadcrumbs[] = $expenses[0]['name'];
     return $this->render('expenses', ['dataProvider' => $dataProvider, 'breadcrumbs' => $breadcrumbs, 'id' => $id, 'data' => $data, 'searchModel' => $searchModel]);
 }
Example #5
0
 public function actionGetTeachersByDepartment()
 {
     $request = Yii::$app->request;
     try {
         $department = HtmlPurifier::process($request->get('id', ''));
         $teachers = Teachers::getTeachersByDepartment($department);
         $department_name = Departments::findOne(['id' => $department])->name;
         Yii::$app->view->registerMetaTag(['name' => 'description', 'content' => 'Bluebee-UET.com - Giảng viên ngành: ' . $department_name]);
         Yii::$app->view->registerMetaTag(['property' => 'og:title', 'content' => 'Bluebee-UET.com - Giảng viên ngành: ' . $department_name]);
         Yii::$app->view->registerMetaTag(['property' => 'og:description', 'content' => 'Bluebee-UET.com - Giảng viên ngành: ' . $department_name]);
         Yii::$app->view->registerMetaTag(['property' => 'og:image', 'content' => 'http://bluebee-uet.com/img/logo.jpg']);
         Yii::$app->view->title = 'Giảng viên ngành: ' . $department_name;
         return $this->render('teachers', $teachers);
     } catch (Exception $ex) {
     }
 }
 /**
  * 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;
 }
Example #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepartments()
 {
     return $this->hasMany(Departments::className(), ['companies_company_id' => 'company_id']);
 }
Example #8
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];
 }
Example #9
0
 public function getDepart()
 {
     return $this->hasOne(Departments::className(), ['id' => 'department_id']);
 }
Example #10
0
 public static function setDepartments($input)
 {
     $departments = Departments::findOne($input['id']);
     $departments->condition = $input['type'];
     $departments->save();
 }
 /**
  * Finds the Departments model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Departments the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Departments::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #12
0
 public function getDepartments()
 {
     return $this->hasOne(Departments::className(), ['id' => 'iddepartment'])->viaTable(Expenses::tableName(), ['id' => 'idexpense']);
 }
Example #13
0
 public function getDeptool()
 {
     // ความสัมพันธ์จาก tools ไปหา departments
     return $this->hasOne(Departments::className(), ['id' => 'department_id']);
 }
Example #14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepartments()
 {
     return $this->hasMany(Departments::className(), ['branches_branch_id' => 'branch_id']);
 }
Example #15
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;
 }
Example #16
0
    ?>
</td>
                    <td><?php 
    echo $model->website;
    ?>
</td>
                    <td><?php 
    echo $model->stars;
    ?>
</td>
                    <td><?php 
    echo $model->number_rated;
    ?>
</td>
                    <td><?php 
    echo \app\models\Departments::findOne(['id' => $model->department])->name;
    ?>
</td>
                    <td><?php 
    echo Date('d/m/Y', $model->created_at);
    ?>
</td>
                    <td>
                        <a class="btn btn-default admin-update" href="#" data-toggle="modal" data-target="#modal-admin-update" data-id="<?php 
    echo $model->id;
    ?>
">Edit</a>
                        <a class="btn btn-danger admin-delete" href="#" data-toggle="modal" data-target="#modal-admin-delete" data-id="<?php 
    echo $model->id;
    ?>
">Delete</a>
Example #17
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>
Example #18
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