oxcontentlist.php

Go to the documentation of this file.
00001 <?php
00002 
00008 class oxContentList extends oxList
00009 {
00015     const TYPE_MAIN_MENU_LIST = 1;
00016 
00022     const TYPE_CATEGORY_MENU = 2;
00023 
00031     public function __construct( $sObjectsInListName = 'oxcontent' )
00032     {
00033         parent::__construct( 'oxcontent');
00034     }
00035 
00041     public function loadMainMenulist()
00042     {
00043         $this->_load( self::TYPE_MAIN_MENU_LIST );
00044     }
00045 
00051     public function loadCatMenues()
00052     {
00053         $this->_load( self::TYPE_CATEGORY_MENU );
00054         $aArray = array();
00055 
00056         if ( $this->count() ) {
00057             foreach ( $this as $oContent ) {
00058                 // add into cattree
00059                 if ( !isset( $aArray[$oContent->oxcontents__oxcatid->value] ) ) {
00060                     $aArray[$oContent->oxcontents__oxcatid->value] = array();
00061                 }
00062 
00063                 $aArray[$oContent->oxcontents__oxcatid->value][] = $oContent;
00064             }
00065         }
00066 
00067         $this->_aArray = $aArray;
00068     }
00069 
00070 
00078     protected function _loadFromDb( $iType )
00079     {
00080         $sSQLAdd = '';
00081         if ( $iType == self::TYPE_CATEGORY_MENU ) {
00082             $sSQLAdd = ' AND `oxcatid` IS NOT NULL';
00083         }
00084 
00085         $sViewName = $this->getBaseObject()->getViewName();
00086         $sSql = "SELECT * FROM {$sViewName} WHERE `oxactive` = '1' AND `oxtype` = '$iType' AND `oxsnippet` = '0' AND `oxshopid` = '$this->_sShopID' $sSQLAdd ORDER BY `oxloadid`";
00087         $aData = oxDb::getDb( oxDb::FETCH_MODE_ASSOC )->getAll( $sSql );
00088 
00089         return $aData;
00090     }
00091 
00099     protected function _load( $iType )
00100     {
00101 
00102            $aData = $this->_loadFromDb( $iType );
00103 
00104         $this->assignArray( $aData );
00105     }
00106 
00107 
00108 }