/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DocumentCategory::find()->where(['is_status' => 0]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['doc_category_id' => SORT_DESC]]]);
     $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(['doc_category_id' => $this->doc_category_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]);
     $query->andFilterWhere(['like', 'doc_category_name', $this->doc_category_name])->andFilterWhere(['like', 'doc_category_user_type', $this->doc_category_user_type]);
     unset($_SESSION['exportData']);
     $_SESSION['exportData'] = $dataProvider;
     return $dataProvider;
 }
Exemple #2
0
/* @var $model app\modules\student\models\StuDocs */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="stu-docs-form">

    <?php 
$form = ActiveForm::begin(['id' => 'stu-docs-form', 'options' => ['class' => 'form-horizontal', 'enctype' => 'multipart/form-data'], 'fieldConfig' => ['template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-7\"><span class='status'>&nbsp;</span>{error}</div>", 'labelOptions' => ['class' => 'col-lg-2 control-label']]]);
?>

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

    <?php 
echo $form->field($model, 'stu_docs_category_id')->dropDownList(ArrayHelper::map(\app\models\DocumentCategory::find()->all(), 'doc_category_id', 'doc_category_name'), ['prompt' => '---Select Category---']);
?>

    <?php 
echo $form->field($model, 'stu_docs_path')->fileInput(['maxlength' => 150]);
?>
	<div class="hint col-sm-offset-1 col-lg-10" style="margin-bottom:2%; color:red"><b>Hint:- </b>&nbsp;Upload Only Jpeg, Jpg, Pdf, Txt, Doc, Png Type Document</div>

    <div class="form-group col-sm-offset-1 col-lg-10">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
	<?php 
echo Html::a('Cancel', ['index'], ['class' => 'btn btn-default']);
?>
    </div>
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getDocumentCategories()
 {
     return $this->hasMany(DocumentCategory::className(), ['updated_by' => 'user_id']);
 }
Exemple #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStuDocsCategory()
 {
     return $this->hasOne(DocumentCategory::className(), ['doc_category_id' => 'stu_docs_category_id']);
 }
 /**
  * Finds the DocumentCategory model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return DocumentCategory the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DocumentCategory::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }