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 = 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 $oManufacturer = oxNew( "oxmanufacturer" );
00034 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00035
00036 $oOtherLang = $oManufacturer->getAvailableInLangs();
00037 if (!isset($oOtherLang[$this->_iEditLang])) {
00038
00039 $oManufacturer->loadInLang( key($oOtherLang), $soxId );
00040 }
00041 $this->_aViewData["edit"] = $oManufacturer;
00042
00043
00044 $sChosenArtCat = $this->_getCategoryTree( "artcattree", oxConfig::getParameter( "artcat"));
00045
00046
00047 if ($oManufacturer->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/manufacturer_main.tpl";
00070 }
00071 return "manufacturer_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['oxmanufacturers__oxactive']))
00086 $aParams['oxmanufacturers__oxactive'] = 0;
00087
00088
00089 $sShopID = oxSession::getVar( "actshop");
00090 $aParams['oxmanufacturers__oxshopid'] = $sShopID;
00091
00092 $oManufacturer = oxNew( "oxmanufacturer" );
00093
00094 if ( $soxId != "-1")
00095 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00096 else {
00097 $aParams['oxmanufacturers__oxid'] = null;
00098 }
00099
00100
00101
00102 $oManufacturer->setLanguage(0);
00103 $oManufacturer->assign( $aParams);
00104 $oManufacturer->setLanguage($this->_iEditLang);
00105 $oManufacturer = oxUtilsFile::getInstance()->processFiles( $oManufacturer );
00106 $oManufacturer->save();
00107 $this->_aViewData["updatelist"] = "1";
00108
00109
00110 if ( $soxId == "-1")
00111 oxSession::setVar( "saved_oxid", $oManufacturer->oxmanufacturers__oxid->value);
00112 }
00113
00119 public function saveinnlang()
00120 {
00121 $soxId = oxConfig::getParameter( "oxid");
00122 $aParams = oxConfig::getParameter( "editval");
00123
00124 if ( !isset( $aParams['oxmanufacturers__oxactive']))
00125 $aParams['oxmanufacturers__oxactive'] = 0;
00126
00127
00128 $sShopID = oxSession::getVar( "actshop");
00129 $aParams['oxmanufacturers__oxshopid'] = $sShopID;
00130
00131 $oManufacturer = oxNew( "oxmanufacturer" );
00132
00133 if ( $soxId != "-1")
00134 $oManufacturer->loadInLang( $this->_iEditLang, $soxId );
00135 else {
00136 $aParams['oxmanufacturers__oxid'] = null;
00137 }
00138
00139
00140
00141 $oManufacturer->setLanguage(0);
00142 $oManufacturer->assign( $aParams);
00143 $oManufacturer->setLanguage($this->_iEditLang);
00144 $oManufacturer = oxUtilsFile::getInstance()->processFiles( $oManufacturer );
00145 $oManufacturer->save();
00146 $this->_aViewData["updatelist"] = "1";
00147
00148
00149 if ( $soxId == "-1")
00150 oxSession::setVar( "saved_oxid", $oManufacturer->oxmanufacturers__oxid->value);
00151 }
00152 }