/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Menus();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $videos = VideoImg::getVideos();
     if (isset($_POST['Menus'])) {
         $model->attributes = $_POST['Menus'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'videos' => $videos));
 }
Exemplo n.º 2
0
 public static function getVideos()
 {
     $model = VideoImg::model()->findAll();
     return CHtml::listData($model, 'id', 'name');
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return VideoImg the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = VideoImg::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 4
0
?>
                        </div>
                    </div>

                    <div class="row top">
                        <div class="col-md-3">
                            <?php 
echo $form->labelEx($model, 'video');
?>
                            <?php 
// echo $form->textField($model, 'video');
?>
                        </div>
                        <div class="col-md-9">
                            <?php 
echo $form->dropDownList($model, 'video', VideoImg::getVideos(), array('empty' => 'Select'), array('options' => array($model->video => array('selected' => true))));
?>
                            <?php 
echo $form->error($model, 'video');
?>
                        </div>
                    </div>

                    <div class="row top buttons">
                        <div class="col-md-3">
                        </div>
                        <div class="col-md-9">
                            <?php 
echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Submit', array('class' => 'btn btn-primary '));
?>
                        </div>