/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Category(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Category'])) { $model->attributes = $_POST['Category']; if ($model->save()) { Yii::app()->user->setFlash(YFlashMessages::NOTICE_MESSAGE, Yii::t('category', 'Категория добавлена!')); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'categoryes' => $model->getAllCategoryList())); }
<?php /* @var $this BusinessController */ /* @var $form CActiveForm */ $catmodel = new Category(); $categories = $catmodel->getAllCategoryList(); ?> <?php $query = "SELECT * FROM category where status=1"; $command = Yii::app()->db->createCommand($query); $rawData = $command->queryAll(); //echo '<pre>'; var_dump($rawData); echo '</pre>'; ?> <script> $(document).ready(function(){ var actionUrl = '<?php echo Yii::app()->createUrl('search/search/'); ?> '; jQuery('#tag').autocomplete(actionUrl, { selectFirst: true }); }); </script> <div class="search-main-container" style="margin:30px auto 20px auto; height:50px;">