navigation.php

Go to the documentation of this file.
00001 <?php
00002 
00006 class Navigation extends oxAdminView
00007 {
00014     public function render()
00015     {
00016         parent::render();
00017         $myUtilsServer = oxUtilsServer::getInstance();
00018 
00019         $sItem = oxConfig::getParameter( "item");
00020         if ( !isset( $sItem) || !$sItem ) {
00021             $sItem = "nav_frame.tpl";
00022 
00023             $aFavorites = oxConfig::getParameter( "favorites");
00024             if(is_array($aFavorites)) {
00025                 $myUtilsServer->setOxCookie('oxidadminfavorites',implode('|',$aFavorites));
00026             }
00027 
00028         } else {
00029             // set menu structure
00030             $this->_aViewData["menustructure"] =  $this->getNavigation()->getDomXml()->documentElement->childNodes;
00031 
00032             // version patch strin
00033             $sVersion = str_replace( array("EE.","PE."), "", $this->_sShopVersion);
00034             $this->_aViewData["sVersion"] =  trim($sVersion);
00035 
00036             // #661 execute stuff we run each time when we start admin once
00037             $this->_aViewData['aMessage'] = $this->_doStartUpChecks();
00038 
00039             // favorite navigation
00040             $aFavorites = explode('|',$myUtilsServer->getOxCookie('oxidadminfavorites'));
00041 
00042             if(is_array($aFavorites) && count($aFavorites)) {
00043                  $this->_aViewData["menufavorites"] = $this->getNavigation()->getListNodes($aFavorites);
00044                  $this->_aViewData["aFavorites"]    = $aFavorites;
00045             }
00046 
00047             // history navigation
00048             $aHistory = explode('|',$myUtilsServer->getOxCookie('oxidadminhistory'));
00049             if(is_array($aHistory) && count($aHistory)) {
00050                 $this->_aViewData["menuhistory"] = $this->getNavigation()->getListNodes($aHistory);
00051             }
00052 
00053             // open history node ?
00054             $this->_aViewData["blOpenHistory"] = oxConfig::getParameter( 'openHistory' );
00055         }
00056 
00057         $oShoplist = oxNew( 'oxshoplist' );
00058         $oBaseShop = $oShoplist->getBaseObject();
00059 
00060         $sWhere = '';
00061         $blisMallAdmin = oxSession::getVar( 'malladmin' );
00062         if ( !$blisMallAdmin) {
00063             // we only allow to see our shop
00064             $sShopID = oxSession::getVar( "actshop" );
00065             $sWhere = "where oxshops.oxid = '$sShopID'";
00066         }
00067 
00068         $oShoplist->selectString( "select ".$oBaseShop->getSelectFields()." from " . $oBaseShop->getViewName() . " $sWhere" );
00069         $this->_aViewData['shoplist'] = $oShoplist;
00070 
00071         return $sItem;
00072     }
00073 
00079     public function logout()
00080     {
00081         $mySession = $this->getSession();
00082         $myConfig  = $this->getConfig();
00083 
00084         $oUser = oxNew( "oxuser" );
00085         $oUser->logout();
00086 
00087         // dodger - Task #1364 - Logout-Button
00088         // store
00089         $sSID = $mySession->getId();
00090 
00091         // kill session
00092         $mySession->destroy();
00093 
00094         // delete also, this is usually not needed but for security reasons we execute still
00095         if ( $myConfig->getConfigParam( 'blAdodbSessionHandler' ) ) {
00096             $sSQL = "delete from oxsessions where SessionID = '$sSID'";
00097             oxDb::getDb()->Execute( $sSQL);
00098         }
00099 
00100         //reseting content cache if needed
00101         $blDeleteCache = $this->getConfig()->getConfigParam( 'blClearCacheOnLogout' );
00102         if ( $blDeleteCache ) {
00103             $this->resetContentCache( $blDeleteCache );
00104         }
00105 
00106         oxUtils::getInstance()->redirect( 'index.php' );
00107     }
00108 
00115     protected function _doStartUpChecks()
00116     {   // #661
00117         $aMessage = array();
00118 /*
00119             // check if there are any links in oxobject2category which are outdated or old
00120             $sSQL = "select oxobject2category.oxid from oxcategories, oxobject2category left join oxarticles on oxarticles.oxid = oxobject2category.oxobjectid  where oxcategories.oxid = oxobject2category.oxcatnid and oxarticles.oxid is null";
00121             $iCnt = 0;
00122             $sDel = "";
00123             $rs = oxDb::getDb()->Execute( $sSQL);
00124             if ($rs != false && $rs->recordCount() > 0) {
00125                 while (!$rs->EOF) {
00126                     if ( $iCnt)
00127                         $sDel .= ",";
00128                     $sDel .= "'".$rs->fields[0]."'";
00129                     $iCnt++;
00130                     $rs->moveNext();
00131                 }
00132                 // delete it now
00133                 oxDb::getDb()->Execute("delete from oxobject2category where oxid in ($sDel)");
00134                 $aMessage['message'] = "- Deleted $iCnt old/outdated entries in table oxobject2category.<br>";
00135             }
00136 */
00137         // check if system reguirements are ok
00138         $oSysReq = new oxSysRequirements();
00139         if ( !$oSysReq->getSysReqStatus() ) {
00140             $aMessage['warning']  = oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE');
00141             $aMessage['warning'] .= '<a href="?cl=sysreq" target="basefrm">';
00142             $aMessage['warning'] .= oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE2').'</a>';
00143         }
00144 
00145         // version check
00146         if ( $sVersionNotice = $this->_checkVersion() ) {
00147             $aMessage['message'] .= $sVersionNotice;
00148         }
00149 
00150         return $aMessage;
00151     }
00152 
00158     protected function _checkVersion()
00159     {
00160             $sVersion = 'CE';
00161 
00162         $sQuery = 'http://admin.oxid-esales.com/'.$sVersion.'/onlinecheck.php?getlatestversion';
00163         if ( $sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString( $sQuery ) ) {
00164             // current version is older ..
00165             if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00166                 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00167             }
00168         }
00169     }
00170 }

Generated on Wed Apr 22 12:26:29 2009 for OXID eShop CE by  doxygen 1.5.5