/** * Finds the Board model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Board the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Board::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionView($alias) { $model = Board::find()->where(['alias' => $alias])->one(); if (!$model) { throw new HttpException('404', 'Сотрудник не найден'); } return $this->render('view', ['model' => $model]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Board::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $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(['id' => $this->id, 'categoryId' => $this->categoryId]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'alias', $this->alias]); return $dataProvider; }
<li> <a href="<?php echo Url::to(['/cms/default/page', 'path' => 'reabilitaciya']); ?> "> <img src="<?php echo $this->theme->getUrl('img/8.jpg'); ?> "/> <span> реабилитация</span> </a> </li> </ul> </div> <?php if ($specList = \app\modules\directorBoard\models\Board::getAll()) { ?> <div class="spec_bg"> <div class="cr"> <div class="title"> <h2>НАШИ СПЕЦИАЛИСТЫ</h2> </div> <div id="hWrapperAuto"> <div id="carouselhAuto" > <?php foreach ($specList as $spec) { ?> <div> <img alt="" src="<?php echo $spec->image->resize('187x187'); ?>
use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model app\modules\directorBoard\models\Board */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="board-form"> <?php $form = ActiveForm::begin(); ?> <br/> <!--div class="row"> <div class="col-md-12"> <?php echo $form->field($model, 'categoryId')->dropDownList(\app\modules\directorBoard\models\Board::categoryList()); ?> </div> </div--> <div class="row"> <div class="col-md-6"> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 128]); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'alias')->textInput(['maxlength' => 128]); ?> </div>