예제 #1
0
 /**
  * Finds the PatternType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PatternType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PatternType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PatternType::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]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias]);
     return $dataProvider;
 }
예제 #3
0
<div class="pattern-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'group_id')->dropdownList(\common\models\PatternGroup::find()->select(['name', 'id'])->indexBy('id')->column(), ['prompt' => 'Group:'])->label('Group');
?>

    <?php 
echo $form->field($model, 'module')->dropDownList(['country' => 'Country', 'city' => 'City', 'direction' => 'Direction', 'airport' => 'Airport', 'airline' => 'Airline'], ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'type_id')->dropdownList(\common\models\PatternType::find()->select(['alias', 'id'])->indexBy('id')->column(), ['prompt' => 'Type:'])->label('Type');
?>


    <?php 
// if ($model && $model->type->is_editor)
?>
    <?php 
echo $form->field($model, 'value')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen'], 'pastePlainText' => false, 'paragraphize' => false]]);
?>

    <?php 
//= $form->field($model, 'priority')->textInput()
?>

    <div class="form-group">
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getType()
 {
     return $this->hasOne(PatternType::className(), ['id' => 'type_id']);
 }