/**
  * Finds the TicketType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TicketType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (\Yii::$app->user->isGuest) {
         return $this->redirect('/site/denied/');
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return $this->redirect('/site/denied/');
     }
     if (($model = TicketType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
/* @var $model app\models\Ticket */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="ticket-form">

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

    <?php 
echo $form->field($model, 'group_id')->dropDownList(TicketGroup::getList());
?>

    <?php 
echo $form->field($model, 'type_id')->dropDownList(TicketType::getList());
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'ticket_price')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'ticket_fee')->hiddenInput(['value' => Yii::$app->params['ticketFee']])->label(false);
?>
    <div class="form-group">
        <label class="control-label"><?php 
Example #3
0
 public function getType()
 {
     return $this->hasOne(TicketType::className(), ['id' => 'type_id']);
 }