/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Organisations::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(['uid' => $this->uid]); $query->andFilterWhere(['like', 'label', $this->label])->andFilterWhere(['like', 'abbreviation', $this->abbreviation])->andFilterWhere(['like', 'latinName', $this->latinName])->andFilterWhere(['like', 'category', $this->category])->andFilterWhere(['like', 'organizationDomains', $this->organizationDomains])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'supervisorId', $this->supervisorId])->andFilterWhere(['like', 'supervisorLabel', $this->supervisorLabel])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'odeManagerEmail', $this->odeManagerEmail])->andFilterWhere(['like', 'vatNumber', $this->vatNumber])->andFilterWhere(['like', 'fekNumber', $this->fekNumber])->andFilterWhere(['like', 'fekIssue', $this->fekIssue]); return $dataProvider; }
use app\models\Cpv; use app\models\Preferences; use dosamigos\chartjs\ChartJs; use kartik\grid\GridView; use yii\data\SqlDataProvider; use yii\web\JsExpression; $url = \yii\helpers\Url::to(['cpvlist']); /* @var $this yii\web\View */ /* @var $model app\models\Decisions */ /* @var $form ActiveForm */ $this->title = 'Αναζήτηση'; $this->params['breadcrumbs'][] = $this->title; $connection = \Yii::$app->db; // Select Organisations : // 1. Get Data From Preferences $currentOrgs = Organisations::dropdownSearch(); // Select Decision Types : // 1. Get Data From Preferences $currentTypes = Preferences::getSelectedTypes(); // Select Date Range: // 1. Get Data From Preferences $currentDates = Preferences::getSelectedDates(); $currentCPV = Cpv::dropdownSearch(); ?> <h1><?php echo Html::encode($this->title); ?> </h1> <h1 style="text-align: center;"> Αποφάσεις Β.2.1 - Έγκριση Δαπανών</h1>
?> <div class="organisations-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::beginForm('', 'post', ['class' => 'uk-width-medium-1-1 uk-form uk-form-horizontal']); ?> <?php echo Select2::widget(['name' => 'country_code', 'data' => Organisations::dropdown(), 'options' => ['id' => 'country_select', 'multiple' => false, 'placeholder' => 'Choose...', 'class' => 'uk-width-medium-7-10']]); ?> <?php AjaxSubmitButton::begin(['label' => 'Refresh', 'ajaxOptions' => ['type' => 'POST', 'url' => 'index.php?r=organisations/refreshdata1', 'success' => new \yii\web\JsExpression('function(html){ $("#output").html(html); }')], 'options' => ['class' => 'btn btn-primary', 'type' => 'submit']]); AjaxSubmitButton::end(); ?> <?php echo Html::endForm(); ?> </p> <div id="output"></div> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'uid', 'label', 'abbreviation', 'category', 'website', ['class' => 'yii\\grid\\ActionColumn']]]); ?>
/** * Finds the Organisations model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Organisations the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Organisations::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<h1><?php echo Html::encode($this->title); ?> </h1> <div class="row"> <div style="text-align: justify;" class="col-lg-7"> <?php // Select Organisations : // 1. Get Data From Preferences $currentOrgs = Preferences::getSelectedOrgIds(); echo Html::beginForm('admnin_panel', 'post', ['class' => 'uk-width-medium-1-1 uk-form uk-form-horizontal']); // 2. Show selected Organisations echo '<label class="control-label">Οργανισμοί</label>'; echo Select2::widget(['name' => 'select_orgs', 'data' => Organisations::dropdown(), 'value' => $currentOrgs, 'options' => ['placeholder' => 'Επιλέξτε τους Οργανισμούς που θέλετε ...', 'multiple' => true]]); ?> <br> <?php // Select Decision Types : // 1. Get Data From Preferences $currentTypes = Preferences::getSelectedTypes(); // 2. Show selected Types echo '<label class="control-label">Τύποι Αποφάσεων</label>'; echo Select2::widget(['name' => 'select_types', 'data' => ['Β.1.3' => 'Β.1.3', 'Β.2.1' => 'Β.2.1', 'Β.2.2' => 'Β.2.2', 'Δ.1' => 'Δ.1', 'Δ.2.1' => 'Δ.2.1', 'Δ.2.2' => 'Δ.2.2'], 'value' => $currentTypes, 'options' => ['placeholder' => 'Επιλέξτε τους Τύπους Αποφάσεων που θέλετε ...', 'multiple' => true]]); ?> <br> <?php // Select Date Range: // 1. Get Data From Preferences
public function getOrganisations() { return Organisations::findBySql("SELECT uid, label FROM organisations"); }