Go to the documentation of this file.00001 <?php
00002
00007 class Vendor_Main extends oxAdminDetails
00008 {
00016 public function render()
00017 {
00018 parent::render();
00019
00020 $soxId = oxConfig::getParameter( "oxid");
00021
00022 $sSavedID = oxConfig::getParameter( "saved_oxid");
00023 if ( ($soxId == "-1" || !isset( $soxId)) && isset( $sSavedID) ) {
00024 $soxId = $sSavedID;
00025 oxSession::deleteVar( "saved_oxid");
00026 $this->_aViewData["oxid"] = $soxId;
00027
00028 $this->_aViewData["updatelist"] = "1";
00029 }
00030
00031 if ( $soxId != "-1" && isset( $soxId)) {
00032
00033 $oVendor = oxNew( "oxvendor" );
00034 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00035
00036 $oOtherLang = $oVendor->getAvailableInLangs();
00037 if (!isset($oOtherLang[$this->_iEditLang])) {
00038
00039 $oVendor->loadInLang( key($oOtherLang), $soxId );
00040 }
00041 $this->_aViewData["edit"] = $oVendor;
00042
00043
00044 $sChosenArtCat = $this->_getCategoryTree( "artcattree", oxConfig::getParameter( "artcat"));
00045
00046
00047 if ($oVendor->isDerived())
00048 $this->_aViewData['readonly'] = true;
00049
00050
00051 $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang);
00052 if ( count( $aLang))
00053 $this->_aViewData["posslang"] = $aLang;
00054
00055 foreach ( $oOtherLang as $id => $language) {
00056 $oLang= new oxStdClass();
00057 $oLang->sLangDesc = $language;
00058 $oLang->selected = ($id == $this->_iEditLang);
00059 $this->_aViewData["otherlang"][$id] = clone $oLang;
00060 }
00061 }
00062
00063 if ( oxConfig::getParameter( "aoc" ) ) {
00064
00065 $aColumns = array();
00066 include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00067 $this->_aViewData['oxajax'] = $aColumns;
00068
00069 return "popups/vendor_main.tpl";
00070 }
00071 return "vendor_main.tpl";
00072 }
00073
00079 public function save()
00080 {
00081
00082 $soxId = oxConfig::getParameter( "oxid" );
00083 $aParams = oxConfig::getParameter( "editval" );
00084
00085 if ( !isset( $aParams['oxvendor__oxactive'] ) ) {
00086 $aParams['oxvendor__oxactive'] = 0;
00087 }
00088
00089
00090 $aParams['oxvendor__oxshopid'] = oxSession::getVar( "actshop");
00091
00092 $oVendor = oxNew( "oxvendor" );
00093 if ( $soxId != "-1" )
00094 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00095 else {
00096 $aParams['oxvendor__oxid'] = null;
00097 }
00098
00099
00100 $oVendor->setLanguage(0);
00101 $oVendor->assign( $aParams );
00102 $oVendor->setLanguage( $this->_iEditLang );
00103 $oVendor = oxUtilsFile::getInstance()->processFiles( $oVendor );
00104 $oVendor->save();
00105 $this->_aViewData["updatelist"] = "1";
00106
00107
00108 if ( $soxId == "-1" ) {
00109 oxSession::setVar( "saved_oxid", $oVendor->oxvendor__oxid->value );
00110 }
00111 }
00112
00118 public function saveinnlang()
00119 {
00120 $soxId = oxConfig::getParameter( "oxid" );
00121 $aParams = oxConfig::getParameter( "editval" );
00122
00123 if ( !isset( $aParams['oxvendor__oxactive'] ) ) {
00124 $aParams['oxvendor__oxactive'] = 0;
00125 }
00126
00127
00128 $aParams['oxvendor__oxshopid'] = oxSession::getVar( "actshop" );
00129
00130 $oVendor = oxNew( "oxvendor" );
00131
00132 if ( $soxId != "-1")
00133 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00134 else {
00135 $aParams['oxvendor__oxid'] = null;
00136 }
00137
00138
00139 $oVendor->setLanguage(0);
00140 $oVendor->assign( $aParams );
00141 $oVendor->setLanguage( $this->_iEditLang );
00142 $oVendor = oxUtilsFile::getInstance()->processFiles( $oVendor );
00143 $oVendor->save();
00144 $this->_aViewData["updatelist"] = "1";
00145
00146
00147 if ( $soxId == "-1" ) {
00148 oxSession::setVar( "saved_oxid", $oVendor->oxvendor__oxid->value);
00149 }
00150 }
00151 }