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 = $this->_aViewData["oxid"] = $this->getEditObjectId();
00021 if ( $soxId != "-1" && isset( $soxId)) {
00022
00023 $oVendor = oxNew( "oxvendor" );
00024 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00025
00026 $oOtherLang = $oVendor->getAvailableInLangs();
00027 if (!isset($oOtherLang[$this->_iEditLang])) {
00028
00029 $oVendor->loadInLang( key($oOtherLang), $soxId );
00030 }
00031 $this->_aViewData["edit"] = $oVendor;
00032
00033
00034 $sChosenArtCat = $this->_getCategoryTree( "artcattree", oxConfig::getParameter( "artcat"));
00035
00036
00037 if ($oVendor->isDerived())
00038 $this->_aViewData['readonly'] = true;
00039
00040
00041 $aLang = array_diff ( oxLang::getInstance()->getLanguageNames(), $oOtherLang);
00042 if ( count( $aLang))
00043 $this->_aViewData["posslang"] = $aLang;
00044
00045 foreach ( $oOtherLang as $id => $language) {
00046 $oLang= new oxStdClass();
00047 $oLang->sLangDesc = $language;
00048 $oLang->selected = ($id == $this->_iEditLang);
00049 $this->_aViewData["otherlang"][$id] = clone $oLang;
00050 }
00051 }
00052
00053 if ( oxConfig::getParameter( "aoc" ) ) {
00054
00055 $aColumns = array();
00056 include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00057 $this->_aViewData['oxajax'] = $aColumns;
00058
00059 return "popups/vendor_main.tpl";
00060 }
00061 return "vendor_main.tpl";
00062 }
00063
00069 public function save()
00070 {
00071
00072 $soxId = $this->getEditObjectId();
00073 $aParams = oxConfig::getParameter( "editval" );
00074
00075 if ( !isset( $aParams['oxvendor__oxactive'] ) ) {
00076 $aParams['oxvendor__oxactive'] = 0;
00077 }
00078
00079
00080 $aParams['oxvendor__oxshopid'] = oxSession::getVar( "actshop");
00081
00082 $oVendor = oxNew( "oxvendor" );
00083 if ( $soxId != "-1" )
00084 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00085 else {
00086 $aParams['oxvendor__oxid'] = null;
00087 }
00088
00089
00090 $oVendor->setLanguage(0);
00091 $oVendor->assign( $aParams );
00092 $oVendor->setLanguage( $this->_iEditLang );
00093 $oVendor = oxUtilsFile::getInstance()->processFiles( $oVendor );
00094 $oVendor->save();
00095
00096
00097 $this->setEditObjectId( $oVendor->getId() );
00098 }
00099
00105 public function saveinnlang()
00106 {
00107 $soxId = $this->getEditObjectId();
00108 $aParams = oxConfig::getParameter( "editval" );
00109
00110 if ( !isset( $aParams['oxvendor__oxactive'] ) ) {
00111 $aParams['oxvendor__oxactive'] = 0;
00112 }
00113
00114
00115 $aParams['oxvendor__oxshopid'] = oxSession::getVar( "actshop" );
00116
00117 $oVendor = oxNew( "oxvendor" );
00118
00119 if ( $soxId != "-1")
00120 $oVendor->loadInLang( $this->_iEditLang, $soxId );
00121 else {
00122 $aParams['oxvendor__oxid'] = null;
00123 }
00124
00125
00126 $oVendor->setLanguage(0);
00127 $oVendor->assign( $aParams );
00128 $oVendor->setLanguage( $this->_iEditLang );
00129 $oVendor = oxUtilsFile::getInstance()->processFiles( $oVendor );
00130 $oVendor->save();
00131
00132
00133 $this->setEditObjectId( $oVendor->getId() );
00134 }
00135 }