Example #1
0
 public function actionManage()
 {
     $model = new Category('search');
     $model->unsetAttributes();
     if (isset($_GET['Category'])) {
         $model->setAttributes($_GET['Category']);
     }
     $this->render('manage', array('model' => $model));
 }
 /**
  * Manages all models.
  */
 public function actionIndex()
 {
     $model = new Category('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $this->render('index', array('model' => $model));
 }
 public function actionIndex()
 {
     $this->pageTitle = 'Теги';
     $this->breadcrumbs = array('Теги');
     $model = new Category('search');
     $model->unsetAttributes();
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $dataProvider = $model->active()->search();
     $this->render('index', array('model' => $model, 'dataProvider' => $dataProvider));
 }
    public function actionIndex() {
    	
        $this->pageTitle = 'Рубрики';

        $model = new Category('search');
        $model->unsetAttributes();

        if(isset($_GET['Category']))
            $model->attributes=$_GET['Category'];


        $dataProvider = $model->search();

        $this->render('index', array(
            'model' => $model,
            'dataProvider'=>$dataProvider,
        ));
    }
 public function actionAdmin()
 {
     $model = new Category('search');
     $model->unsetAttributes();
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $this->render('admin', array('model' => $model));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Category('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     if ($this->isExportRequest()) {
         $this->exportCSV($model->search(), array('name', 'descr', 'pid', 'getparent.name'));
     }
     $this->render('admin', array('model' => $model));
 }
Example #7
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Category('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     if (isset($_GET['pageSize'])) {
         Yii::app()->user->setState('categoryPageSize', (int) $_GET['pageSize']);
         unset($_GET['pageSize']);
     }
     $this->render('admin', array('model' => $model));
 }
Example #8
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id)) {
         $model = new Category('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Category'])) {
             $model->attributes = $_GET['Category'];
         }
         $this->render('admin', array('model' => $model));
     } else {
         $this->accessDenied();
     }
 }
Example #9
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     date_default_timezone_set("Asia/Manila");
     $activity = new Activity();
     $activity->act_desc = 'Viewed Category List';
     $activity->act_datetime = date('Y-m-d G:i:s');
     $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
     $activity->save();
     $model = new Category('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $this->render('admin', array('model' => $model));
 }
 public function commonsectionAdmin($root = false)
 {
     $this->pageTitle = get_class( Category::model() );
     $model = new Category( 'search' );
     $model->unsetAttributes();  // clear any default values        
     if ( isset( $_GET['Category'] ) )
         $model->attributes = $_GET['Category'];
     if($root)
     {
        $model->parent_id = Helper::CONST_RootCategory;
     }
     else
     {
         $model->parent_id = Helper::CONST_Category;
     }
     
     $this->render( 'admin1', array(
         'model' => $model,
     ) );
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $this->layout = 'site-admin';
     $this->activeMenuItemIndex = 2;
     $model = new Category('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $this->render('admin', array('model' => $model));
 }
Example #12
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Category('search');
     $catlist = Category::getDropList(0);
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $model->attributes = $_GET['Category'];
     }
     $this->render('admin', array('model' => $model, 'catlist' => $catlist));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $lang = $this->getLanguageCode();
     $model = new Category();
     $listCate = $model->getListCategory($lang);
     $model->unsetAttributes();
     $tree = Yii::app()->extraFunctions->parseTree($listCate);
     $this->render('admin', array('tree' => json_encode($tree)));
 }
 /**
  * Displays a particular model's products as a long list.
  * @param str $slug the 'slug' identifier of the model to be displayed
  */
 public function actionList($slug)
 {
     // Retrieve the model via it's slug
     $model_localization = $this->loadLocalizationModelSlug($slug);
     $model = $model_localization->category;
     if (!$model->visible) {
         throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
     }
     $this->pageTitle = $model_localization->name . " - " . Yii::app()->name;
     $alternatives = array();
     foreach ($model->categoryLocalizations as $localization) {
         $alternatives[$localization->locale_id] = $this->createAbsoluteUrl("view", array("slug" => $localization->slug, "language" => $localization->locale_id));
     }
     $this->alternatives = $alternatives;
     // Generate the subcategories to display in the sidebar.
     // Generate the subcategories to display in the sidebar.
     $children_cache_id = Yii::app()->request->hostInfo . " CategoryController:[children_cats_for_cat] " . $model->id;
     $cache_duration = 300;
     $menu_array = Yii::app()->cache->get($children_cache_id);
     if (!$menu_array) {
         $menu_array = array();
         $children = new Category();
         $children->unsetAttributes();
         $children->visible = 1;
         $children->id = $model->id;
         $category_data_provider = $children->searchChildren();
         foreach ($category_data_provider->getData() as $child) {
             if ($this->isB2b()) {
                 // In a B2B store, we show a list of products so users can select many products at once
                 $menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/list', "slug" => $child->categoryLocalization->slug));
             } else {
                 $menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/view', "slug" => $child->categoryLocalization->slug));
             }
         }
         Yii::app()->cache->set($children_cache_id, $menu_array, $cache_duration);
     }
     $this->menu = $menu_array;
     if ($model->parent_category) {
         // This is a subcategory
         // Subcategories must display their products. They must also add their parents categories to the page's breadcrumbs
         // Display breadcrumbs in the right order (home >> root category >> subcategory 1 >> subcatory 2, etc.)
         $this->breadcrumbs = array();
         function appendMotherCatToBreadcrumbs($cat, &$breadarray, $locale)
         {
             $locale_category = CategoryLocalization::model()->find("category_id = :category AND locale_id = :locale", array(":category" => $cat->id, ":locale" => $locale));
             $breadarray[$locale_category->name] = array("category/view", "slug" => $locale_category->slug);
             if ($cat->parent_category) {
                 appendMotherCatToBreadcrumbs($cat->parentCategory, $breadarray, $locale);
             }
         }
         if ($model->parent_category) {
             appendMotherCatToBreadcrumbs($model->parentCategory, $this->breadcrumbs, Yii::app()->language);
             // The array returned is reversed (top category at the end) we need to reverse it.
             $this->breadcrumbs = array_reverse($this->breadcrumbs);
         }
         // We're at the end of the run, just append our name
         $this->breadcrumbs[] = $model_localization->name;
         // Retrieve the order's products (with the correct localization)
         $products_data_provider = null;
         $product = new Product();
         $product->unsetAttributes();
         $product->visible = 1;
         $product->discontinued = 0;
         $product->categoryId = $model->id;
         $product->restrictScopeToCurrentLocale = false;
         if ($model->is_brand) {
             $products_data_provider = $product->searchForBrand($model);
         } else {
             $products_data_provider = $product->search();
         }
         $products_data_provider->setPagination(array('pageSize' => 100));
         $this->render('list', array('model' => $model, 'localization' => $model_localization, 'products' => $products_data_provider));
     } else {
         throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
     }
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $Category = new Category('search');
     $Category->unsetAttributes();
     // clear any default values
     if (isset($_GET['Category'])) {
         $Category->attributes = $_GET['Category'];
     }
     $this->render('admin', array('Category' => $Category));
 }