category_list.php

Go to the documentation of this file.
00001 <?php
00002 
00010 class Category_List extends oxAdminList
00011 {
00017     protected $_sListClass = 'oxcategory';
00018 
00024     protected $_sListType = 'oxcategorylist';
00025 
00032     public function init()
00033     {
00034         $sCatView = getViewName('oxcategories');
00035         $this->_sDefSort = "$sCatView.oxrootid desc, $sCatView.oxleft";
00036         parent::Init();
00037     }
00038 
00045     public function render()
00046     {
00047         $myConfig = $this->getConfig();
00048 
00049         parent::render();
00050 
00051         $iLang = oxLang::getInstance()->getTplLanguage();
00052 
00053         // parent categorie tree
00054         $oCatTree = oxNew( "oxCategoryList" );
00055         $oCatTree->buildList($myConfig->getConfigParam( 'bl_perfLoadCatTree' ));
00056 
00057         // add Root as fake category
00058         // rebuild list as we need the root entry at the first position
00059         $aNewList = array();
00060         $oRoot = new stdClass();
00061         $oRoot->oxcategories__oxid    = new oxField(null, oxField::T_RAW);
00062         $oRoot->oxcategories__oxtitle = new oxField(oxLang::getInstance()->translateString("viewAll", $iLang ), oxField::T_RAW);
00063 
00064         $aNewList[] = $oRoot;
00065         $oRoot = new stdClass();
00066         $oRoot->oxcategories__oxid    = new oxField("oxrootid", oxField::T_RAW);
00067         $oRoot->oxcategories__oxtitle = new oxField("-- ".oxLang::getInstance()->translateString("mainCategory", $iLang )." --", oxField::T_RAW);
00068         $aNewList[] = $oRoot;
00069 
00070         foreach( $oCatTree as $oCategory )
00071             $aNewList[] = $oCategory;
00072 
00073         $oCatTree->assign( $aNewList );
00074 
00075         $sCatView = getViewName('oxcategories');
00076 
00077         $aWhere  = oxConfig::getParameter( "where");
00078         if ( isset( $aWhere ) && $aWhere ) {
00079             foreach( $oCatTree as $oCategory ) {
00080                 if ( $oCategory->oxcategories__oxid->value == $aWhere[$sCatView.'.oxparentid']) {
00081                     $oCategory->selected = 1;
00082                 }
00083             }
00084         }
00085 
00086         $this->_aViewData["cattree"] =  $oCatTree;
00087 
00088         return "category_list.tpl";
00089     }
00090 }

Generated on Thu Feb 19 15:02:20 2009 for OXID eShop CE by  doxygen 1.5.5