/**
  * Lists all Departmentrole models.
  * @return mixed
  */
 public function actionIndex()
 {
     //        $searchModel = new DepartmentroleSearch();
     //        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $model = \common\models\Departments::find()->all();
     return $this->renderAjax('index', ['model' => $model]);
 }
示例#2
0
 /**
  * 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, 'company_id' => $this->company_id, 'branch_id' => $this->branch_id, 'created_dt' => $this->created_dt, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'department_name', $this->department_name]);
     return $dataProvider;
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepartments()
 {
     return $this->hasMany(Departments::className(), ['branch_id' => 'id']);
 }
示例#4
0
?>

<div class="assignroles-form">

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

    <?php 
$user = new common\models\User();
?>
    <?php 
$dept = new common\models\Departments();
?>
    <?php 
$dept2 = \common\models\Departments::find()->all();
?>
    <?php 
$dept3count = \common\models\Assignroledetail::find()->where(['assignid' => $model->recid])->count();
$dept3 = \common\models\Assignroledetail::find()->where(['assignid' => $model->recid])->all();
?>
    <?php 
$role = new common\models\Roles();
?>
    
    <?php 
echo $form->field($model, 'description')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'userid')->dropDownList(ArrayHelper::map($user->find()->all(), 'id', 'fname'));
示例#5
0
 /**
  * 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.');
     }
 }
示例#6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDepartments()
 {
     return $this->hasMany(Departments::className(), ['sectionid' => 'recid']);
 }