/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsSectors::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'info', $this->info])->andFilterWhere(['like', 'color', $this->color])->andFilterWhere(['like', 'icon', $this->icon]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getSector() { return $this->hasOne(CsSectors::className(), ['id' => 'sector_id']); }
<?php /* @var $this yii\web\View */ use yii\helpers\Html; use yii\helpers\Url; use common\models\CsSectors; ?> <p class="paragraph" style="text-align:center; margin:0 0 20px 0; color:#aaa; font-size:11px;"><?php echo Yii::t('app', 'Choose category by clicking on the colored boxes and then select one of the service industry from the list below.'); ?> </p> <?php foreach (CsSectors::find()->all() as $key => $sek) { ?> <div id="sektor<?php echo $key + 1; ?> " class="fadeInDown animated col-sm-2" <?php echo $key == 0 ? 'style="margin-left:0;"' : ''; ?> > <div class="popup" style="background: linear-gradient(to bottom, <?php echo Yii::$app->operator->hex2rgba($sek->color, 0.1); ?> , <?php echo Yii::$app->operator->hex2rgba($sek->color, 0.9); ?> , <?php echo Yii::$app->operator->hex2rgba($sek->color, 1); ?>
/** * Finds the CsSectors model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CsSectors the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsSectors::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Displays a single User model. * @param string $id * @return mixed */ public function actionFinances($username = null) { $this->layout = '//finances'; if (isset($username)) { $model = $this->findModelByUsername($username); if ($model) { $csSectors = \common\models\CsSectors::find()->all(); return $this->render('finances', ['model' => $model, 'csSectors' => $csSectors]); } else { throw new NotFoundHttpException('The requested page does not exist.'); } } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionInd($id) { $sek = \common\models\CsSectors::findOne($id); return $this->renderPartial('industry-popup', ['sek' => $sek]); }
<?php $form = kartik\widgets\ActiveForm::begin(['id' => 'form-horizontal', 'type' => ActiveForm::TYPE_HORIZONTAL, 'fullSpan' => 7, 'formConfig' => ['labelSpan' => 3, 'deviceSize' => ActiveForm::SIZE_MEDIUM], 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model_trans, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'sector_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsSectors::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]); ?> <?php echo $form->field($model_trans, 'description')->textArea(['rows' => 4]); ?> <div class="row" style="margin:20px;"> <div class="col-md-offset-3"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> <?php