Go to the documentation of this file.00001 <?php
00002
00007 class Manufacturer_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 $oManufacturer = oxNew( "oxmanufacturer" );
00024 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00025
00026 $oOtherLang = $oManufacturer->getAvailableInLangs();
00027 if (!isset($oOtherLang[$this->_iEditLang])) {
00028
00029 $oManufacturer->loadInLang( key($oOtherLang), $soxId );
00030 }
00031 $this->_aViewData["edit"] = $oManufacturer;
00032
00033
00034 $sChosenArtCat = $this->_getCategoryTree( "artcattree", oxConfig::getParameter( "artcat"));
00035
00036
00037 if ($oManufacturer->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/manufacturer_main.tpl";
00060 }
00061 return "manufacturer_main.tpl";
00062 }
00063
00069 public function save()
00070 {
00071 parent::save();
00072
00073 $soxId = $this->getEditObjectId();
00074 $aParams = oxConfig::getParameter( "editval");
00075
00076 if ( !isset( $aParams['oxmanufacturers__oxactive']))
00077 $aParams['oxmanufacturers__oxactive'] = 0;
00078
00079
00080 $sShopID = oxSession::getVar( "actshop");
00081 $aParams['oxmanufacturers__oxshopid'] = $sShopID;
00082
00083 $oManufacturer = oxNew( "oxmanufacturer" );
00084
00085 if ( $soxId != "-1")
00086 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00087 else {
00088 $aParams['oxmanufacturers__oxid'] = null;
00089 }
00090
00091
00092
00093 $oManufacturer->setLanguage(0);
00094 $oManufacturer->assign( $aParams);
00095 $oManufacturer->setLanguage($this->_iEditLang);
00096 $oManufacturer = oxUtilsFile::getInstance()->processFiles( $oManufacturer );
00097 $oManufacturer->save();
00098
00099
00100 $this->setEditObjectId( $oManufacturer->getId() );
00101 }
00102
00108 public function saveinnlang()
00109 {
00110 $soxId = $this->getEditObjectId();
00111 $aParams = oxConfig::getParameter( "editval");
00112
00113 if ( !isset( $aParams['oxmanufacturers__oxactive']))
00114 $aParams['oxmanufacturers__oxactive'] = 0;
00115
00116
00117 $sShopID = oxSession::getVar( "actshop");
00118 $aParams['oxmanufacturers__oxshopid'] = $sShopID;
00119
00120 $oManufacturer = oxNew( "oxmanufacturer" );
00121
00122 if ( $soxId != "-1")
00123 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00124 else {
00125 $aParams['oxmanufacturers__oxid'] = null;
00126 }
00127
00128
00129
00130 $oManufacturer->setLanguage(0);
00131 $oManufacturer->assign( $aParams);
00132 $oManufacturer->setLanguage($this->_iEditLang);
00133 $oManufacturer = oxUtilsFile::getInstance()->processFiles( $oManufacturer );
00134 $oManufacturer->save();
00135
00136
00137 $this->setEditObjectId( $oManufacturer->getId() );
00138 }
00139 }