Exemplo n.º 1
0
Arquivo: _form.php Projeto: myorb/alox
?>

    <?php 
echo $form->field($model, 'address');
?>

    <?php 
echo $form->field($model, 'show_on_map');
?>

    <?php 
echo $form->field($model, 'html');
?>

    <?php 
echo $form->field($model, 'query_id')->dropDownList(\yii\helpers\ArrayHelper::map(\app\models\Query::find()->all(), 'id', 'name'));
?>


    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemplo n.º 2
0
 public static function count($id)
 {
     return Query::find()->where(['author_id' => Yii::$app->user->id])->where(['query_id' => $id])->count();
 }
Exemplo n.º 3
0
 /**
  * Finds the Query model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Query the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Query::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 public static function takeAll()
 {
     $query = Query::find();
     return $query->where(['author_id' => Yii::$app->user->isGuest ? 0 : Yii::$app->user->id])->all();
 }
Exemplo n.º 5
0
 public function getQuery()
 {
     return $this->hasOne(Query::className(), ['id' => 'query_id']);
 }