コード例 #1
0
 /**
  * Initializes the Categorytree.
  */
 public function init()
 {
     parent::init();
     // Create the category leaf
     /**
      * Category leaf.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\Category $categoryLeaf
      */
     $categoryLeaf = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\Category');
     // Instantiate the categorydata, -view and set
     // the permission mask (or the string rep.)
     /**
      * Category data.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryData $categorydata
      */
     $categorydata = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData');
     $categorydata->setPermsMask(BackendUtility::getPermMask($this->minCategoryPerms));
     /**
      * Category view.
      *
      * @var \CommerceTeam\Commerce\ViewHelpers\Browselinks\CategoryView $categoryview
      */
     $categoryview = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\ViewHelpers\\Browselinks\\CategoryView');
     // disable the root onclick if the perms are set to editcontent
     // - this way we cannot select the root as a parent for any content item
     $categoryview->noRootOnclick($this->minCategoryPerms == 'editcontent');
     // Configure the noOnclick for the leaf
     if (GeneralUtility::inList($this->noClickList, 'CommerceTeam\\Commerce\\Tree\\Leaf\\Category')) {
         $categoryview->noOnclick();
     }
     $categoryLeaf->initBasic($categoryview, $categorydata);
     $this->addLeaf($categoryLeaf);
     // Add Product - Productleaf will be added to Categoryleaf
     /**
      * Product leaf.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\Product $productleaf
      */
     $productleaf = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\Product');
     /**
      * Product view.
      *
      * @var \CommerceTeam\Commerce\ViewHelpers\Browselinks\ProductView $productview
      */
     $productview = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\ViewHelpers\\Browselinks\\ProductView');
     // Configure the noOnclick for the leaf
     if (GeneralUtility::inList($this->noClickList, 'CommerceTeam\\Commerce\\Tree\\Leaf\\Product')) {
         $productview->noOnclick();
     }
     /**
      * Product data.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\ProductData $productData
      */
     $productData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData');
     $productleaf->initBasic($productview, $productData);
     $categoryLeaf->addLeaf($productleaf);
 }
コード例 #2
0
 /**
  * Initializes the Categorytree.
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     // Create the category leaf
     /**
      * Category leaf.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\Category $categoryLeaf
      */
     $categoryLeaf = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\Category');
     // Instantiate the categorydata, -view and set
     // the permission mask (or the string rep.)
     /**
      * Category data.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryData $categorydata
      */
     $categorydata = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryData');
     $categorydata->setPermsMask(BackendUtility::getPermMask($this->minCategoryPerms));
     /**
      * Category view.
      *
      * @var \CommerceTeam\Commerce\Tree\Leaf\CategoryView $categoryview
      */
     $categoryview = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\CategoryView');
     // disable the root onclick if the perms are set to editcontent
     // this way we cannot select the root as a parent for any content item
     $categoryview->noRootOnclick($this->minCategoryPerms == 'editcontent');
     // Configure real values
     if (!$this->isNavigationFrame) {
         $categoryview->substituteRealValues();
     }
     // Configure the noOnclick for the leaf
     if (GeneralUtility::inList($this->noClickList, 'CommerceTeam\\Commerce\\Tree\\Leaf\\Category')) {
         $categoryview->noOnclick();
     }
     $categoryLeaf->initBasic($categoryview, $categorydata);
     $this->addLeaf($categoryLeaf);
     // Add Product and Article Leafs if wanted
     // - Productleaf will be added to Categoryleaf,
     // - Articleleaf will be added to Productleaf
     if (!$this->bare) {
         /**
          * Product leaf.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\Product $productleaf
          */
         $productleaf = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\Product');
         /**
          * Article leaf.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\Article $articleleaf
          */
         $articleleaf = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\Article');
         /**
          * Product view.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\ProductView $productview
          */
         $productview = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductView');
         // Configure the noOnclick for the leaf
         if (GeneralUtility::inList($this->noClickList, 'CommerceTeam\\Commerce\\Tree\\Leaf\\Product')) {
             $productview->noOnclick();
         }
         /**
          * Article view.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\ArticleView $articleview
          */
         $articleview = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ArticleView');
         // Configure the noOnclick for the leaf
         if (GeneralUtility::inList($this->noClickList, 'CommerceTeam\\Commerce\\Tree\\Leaf\\Article')) {
             $articleview->noOnclick();
         }
         // Configure real values
         if (!$this->isNavigationFrame) {
             $productview->substituteRealValues();
             $articleview->substituteRealValues();
         }
         /**
          * Product data.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\ProductData $productData
          */
         $productData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ProductData');
         $productleaf->initBasic($productview, $productData);
         /**
          * Article data.
          *
          * @var \CommerceTeam\Commerce\Tree\Leaf\ArticleData $articleData
          */
         $articleData = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Tree\\Leaf\\ArticleData');
         $articleleaf->initBasic($articleview, $articleData);
         $categoryLeaf->addLeaf($productleaf);
         // Do not show articles in simple mode.
         if (!$this->simpleMode) {
             $productleaf->addLeaf($articleleaf);
         }
     }
 }