/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = BudgetTier::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, 'level' => $this->level]); $query->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Finds the BudgetTier model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return BudgetTier the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = BudgetTier::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\widgets\DetailView; use app\models\BudgetTier; use scotthuangzl\googlechart\GoogleChart; /* @var $this yii\web\View */ /* @var $model app\models\Lead */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => 'Leads', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $budgetsize = BudgetTier::findOne(['level' => $model->budget_tier]); ?> <div class="lead-view"> <h1><?php echo Html::encode($this->title); ?> </h1> <h4> <?php echo Html::encode($model->title); ?> </h4> <table> <tr> <td> <?php echo Html::img($model->picture, ['width' => '350', 'height' => '350'], ['alt' => $model->name]); ?> </td>
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use app\models\BudgetTier; $dataList = ArrayHelper::map(BudgetTier::find()->asArray()->all(), 'id', 'description'); /* @var $this yii\web\View */ /* @var $model app\models\Lead */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="lead-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'company')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'company_url')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php