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         // parent categorie tree
00052         $oCatTree = oxNew( "oxCategoryList" );
00053         $oCatTree->buildList($myConfig->getConfigParam( 'bl_perfLoadCatTree' ));
00054 
00055         // add Root as fake category
00056         // rebuild list as we need the root entry at the first position
00057         $aNewList = array();
00058         $oRoot = new stdClass();
00059         $oRoot->oxcategories__oxid    = new oxField(null, oxField::T_RAW);
00060         $oRoot->oxcategories__oxtitle = new oxField(oxLang::getInstance()->translateString("viewAll"), oxField::T_RAW);
00061 
00062         $aNewList[] = $oRoot;
00063         $oRoot = new stdClass();
00064         $oRoot->oxcategories__oxid    = new oxField("oxrootid", oxField::T_RAW);
00065         $oRoot->oxcategories__oxtitle = new oxField("-- ".oxLang::getInstance()->translateString("mainCategory")." --", oxField::T_RAW);
00066         $aNewList[] = $oRoot;
00067 
00068         foreach( $oCatTree as $oCategory )
00069             $aNewList[] = $oCategory;
00070 
00071         $oCatTree->assign( $aNewList );
00072 
00073         $sCatView = getViewName('oxcategories');
00074 
00075         $aWhere  = oxConfig::getParameter( "where");
00076         if ( isset( $aWhere ) && $aWhere ) {
00077             foreach( $oCatTree as $oCategory ) {
00078                 if ( $oCategory->oxcategories__oxid->value == $aWhere[$sCatView.'.oxparentid']) {
00079                     $oCategory->selected = 1;
00080                 }
00081             }
00082         }
00083 
00084         $this->_aViewData["cattree"] =  $oCatTree;
00085 
00086         return "category_list.tpl";
00087     }
00088 }

Generated on Thu Dec 4 12:04:55 2008 for OXID eShop CE by  doxygen 1.5.5