Exemplo n.º 1
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Item('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Item'])) {
         $model->attributes = $_GET['Item'];
     }
     $this->render('admin', array('model' => $model));
 }
Exemplo n.º 2
0
 public function actionOutStock()
 {
     if (Yii::app()->user->checkAccess('item.index')) {
         $model = new Item('outstock');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Item'])) {
             $model->attributes = $_GET['Item'];
         }
         $this->render('_out_stock', array('model' => $model));
     } else {
         throw new CHttpException(403, 'You are not authorized to perform this action');
     }
 }
Exemplo n.º 3
0
 public function actionAdd_goods()
 {
     $this->layout = '/';
     $goods = new Item('search');
     $goods->unsetAttributes();
     if (isset($_GET['Item'])) {
         $goods->attributes = $_GET['Item'];
     }
     $this->render('add_goods', array('goods' => $goods));
 }
 public function actionIndex($alias = '')
 {
     //$this->processPageRequest('page');
     $filter = array();
     // Список видов камней
     $categoryList = Category::model()->published()->findAll(array('order' => 't.sort ASC'));
     // Определяем, выбран или нет вид камня
     $category = null;
     if (!empty($alias)) {
         // Если выбран вид камня
         $category = Category::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->find('t.alias = :alias', array(':alias' => $alias));
         if (!$category) {
             throw new CHttpException(404);
         }
         $page = $category;
         $filter['category_id'] = $category->id;
     } else {
         // Загружаем страницу "Каталог хим. средств"
         Yii::import("application.modules.page.models.Page");
         $page = Page::model()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC')))->findByPath("chemical");
     }
     // Список товаров
     $criteria = new CDbCriteria();
     $criteria->with = array('images' => array('scopes' => 'published', 'order' => 'images.sort ASC'));
     $criteria->order = 't.title ASC';
     $model = new Item('user_search');
     $model->unsetAttributes();
     if (isset($_GET['Item'])) {
         $model->attributes = $_GET['Item'];
         if ($model->title != '') {
             $criteria->condition = "t.title LIKE :title";
             $criteria->params = array(':title' => $model->title . '%');
             $filter['title'] = $model->title;
         }
         if (!empty($model->producer_id)) {
             $criteria->compare('t.producer_id', $model->producer_id);
             $filter['producer_id'] = $model->producer_id;
         }
     }
     // Если выбран вид камня
     if (!empty($category)) {
         $model = $model->category($category->id);
     }
     $dataProvider = new CActiveDataProvider($model->published(), array('criteria' => $criteria, 'pagination' => array('pageVar' => 'page')));
     // Сохраняем ссылку для возврата
     Yii::app()->user->setState('chemicalCatalogReturnUrl', Yii::app()->request->requestUri);
     // Сохраняем данные фильтра в сессии
     //$filter['page'] = (int) Yii::app()->request->getParam('page', 1);
     Yii::app()->user->setState('chemicalCatalogFilter', $filter);
     if (Yii::app()->request->isAjaxRequest) {
         // Обновление списка для бесконечной загрузки элементов
         if (isset($_GET['showMore'])) {
             $this->renderPartial('_list_ajax', array('dataProvider' => $dataProvider, 'pageNumber' => (int) Yii::app()->request->getParam('page', 1)));
         } else {
             $this->renderPartial('_list', array('dataProvider' => $dataProvider), false, true);
         }
         Yii::app()->end();
     } else {
         // Вывод каталога
         $this->render('index', array('page' => $page, 'model' => $model, 'dataProvider' => $dataProvider, 'categoryList' => $categoryList, 'sizerVariants' => $sizerVariants));
     }
 }
 public function actionAdminbycriteria($id, $nama)
 {
     $model = new Item('searchByBarcode($id)');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Item'])) {
         $model->attributes = $_GET['Item'];
     }
     $this->render('admin', array('model' => $model, 'nama' => $nama, 'barcode_id' => $id));
 }
Exemplo n.º 6
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Item('search');
     $model->unsetAttributes();
     // clear any default values
     $vl = 'item-grid';
     if (isset($_POST['Item'])) {
         $model->attributes = $_POST['Item'];
     }
     if (isset($_GET['ajax'])) {
         // Render partial file created in Step 1
         $this->renderPartial('_ajax', array('model' => $model));
         Yii::app()->end();
     }
     //if(isset($_GET['Item']))
     //	$model->attributes=$_GET['Item'];
     $this->render('admin', array('model' => $model));
 }