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         $blDeleteCacheOnLogout = $this->getConfig()->getConfigParam( 'blClearCacheOnLogout' );
00102         if ( $blDeleteCacheOnLogout ) {
00103 
00104                 oxUtils::getInstance()->oxResetFileCache();
00105         }
00106 
00107         oxUtils::getInstance()->redirect( 'index.php' );
00108     }
00109 
00116     protected function _doStartUpChecks()
00117     {   // #661
00118         $aMessage = array();
00119 /*
00120             // check if there are any links in oxobject2category which are outdated or old
00121             $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";
00122             $iCnt = 0;
00123             $sDel = "";
00124             $rs = oxDb::getDb()->Execute( $sSQL);
00125             if ($rs != false && $rs->recordCount() > 0) {
00126                 while (!$rs->EOF) {
00127                     if ( $iCnt)
00128                         $sDel .= ",";
00129                     $sDel .= "'".$rs->fields[0]."'";
00130                     $iCnt++;
00131                     $rs->moveNext();
00132                 }
00133                 // delete it now
00134                 oxDb::getDb()->Execute("delete from oxobject2category where oxid in ($sDel)");
00135                 $aMessage['message'] = "- Deleted $iCnt old/outdated entries in table oxobject2category.<br>";
00136             }
00137 */
00138         // check if system reguirements are ok
00139         $oSysReq = new oxSysRequirements();
00140         if ( !$oSysReq->getSysReqStatus() ) {
00141             $aMessage['warning']  = oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE');
00142             $aMessage['warning'] .= '<a href="?cl=sysreq" target="basefrm">';
00143             $aMessage['warning'] .= oxLang::getInstance()->translateString('NAVIGATION_SYSREQ_MESSAGE2').'</a>';
00144         }
00145 
00146         // version check
00147         if ( $sVersionNotice = $this->_checkVersion() ) {
00148             $aMessage['message'] .= $sVersionNotice;
00149         }
00150 
00151         return $aMessage;
00152     }
00153 
00159     protected function _checkVersion()
00160     {
00161             $sVersion = 'CE';
00162 
00163         $sQuery = 'http://admin.oxid-esales.com/'.$sVersion.'/onlinecheck.php?getlatestversion';
00164         if ( $sVersion = oxUtilsFile::getInstance()->readRemoteFileAsString( $sQuery ) ) {
00165             // current version is older ..
00166             if ( version_compare( $this->getConfig()->getVersion(), $sVersion ) == '-1' ) {
00167                 return sprintf( oxLang::getInstance()->translateString( 'NAVIGATION_NEWVERSIONAVAILABLE' ), $sVersion );
00168             }
00169         }
00170     }
00171 }

Generated on Tue Apr 21 15:45:44 2009 for OXID eShop CE by  doxygen 1.5.5