Go to the documentation of this file.00001 <?php
00002
00008 class Wrapping_Main extends oxAdminDetails
00009 {
00010
00018 public function render()
00019 {
00020 parent::render();
00021
00022 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ($soxId != "-1" && isset($soxId)) {
00024
00025 $oWrapping = oxNew("oxwrapping");
00026 $oWrapping->loadInLang($this->_iEditLang, $soxId);
00027
00028 $oOtherLang = $oWrapping->getAvailableInLangs();
00029 if (!isset($oOtherLang[$this->_iEditLang])) {
00030
00031 $oWrapping->loadInLang(key($oOtherLang), $soxId);
00032 }
00033 $this->_aViewData["edit"] = $oWrapping;
00034
00035
00036
00037 $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00038 if (count($aLang)) {
00039 $this->_aViewData["posslang"] = $aLang;
00040 }
00041
00042 foreach ($oOtherLang as $id => $language) {
00043 $oLang = new stdClass();
00044 $oLang->sLangDesc = $language;
00045 $oLang->selected = ($id == $this->_iEditLang);
00046 $this->_aViewData["otherlang"][$id] = clone $oLang;
00047 }
00048 }
00049
00050 return "wrapping_main.tpl";
00051 }
00052
00058 public function save()
00059 {
00060 parent::save();
00061
00062 $soxId = $this->getEditObjectId();
00063 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00064
00065
00066 if (!isset($aParams['oxwrapping__oxactive'])) {
00067 $aParams['oxwrapping__oxactive'] = 0;
00068 }
00069
00070
00071 $aParams['oxwrapping__oxshopid'] = oxRegistry::getSession()->getVariable("actshop");
00072
00073 $oWrapping = oxNew("oxwrapping");
00074
00075 if ($soxId != "-1") {
00076 $oWrapping->loadInLang($this->_iEditLang, $soxId);
00077
00078 oxRegistry::get("oxUtilsPic")->overwritePic($oWrapping, 'oxwrapping', 'oxpic', 'WP', '0', $aParams, $this->getConfig()->getPictureDir(false));
00079 } else {
00080 $aParams['oxwrapping__oxid'] = null;
00081
00082 }
00083
00084
00085 $oWrapping->setLanguage(0);
00086 $oWrapping->assign($aParams);
00087 $oWrapping->setLanguage($this->_iEditLang);
00088
00089 $oWrapping = oxRegistry::get("oxUtilsFile")->processFiles($oWrapping);
00090 $oWrapping->save();
00091
00092
00093 $this->setEditObjectId($oWrapping->getId());
00094 }
00095
00101 public function saveinnlang()
00102 {
00103 $soxId = $this->getEditObjectId();
00104 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00105
00106
00107 if (!isset($aParams['oxwrapping__oxactive'])) {
00108 $aParams['oxwrapping__oxactive'] = 0;
00109 }
00110
00111
00112 $aParams['oxwrapping__oxshopid'] = oxRegistry::getSession()->getVariable("actshop");
00113
00114 $oWrapping = oxNew("oxwrapping");
00115
00116 if ($soxId != "-1") {
00117 $oWrapping->load($soxId);
00118 } else {
00119 $aParams['oxwrapping__oxid'] = null;
00120
00121 }
00122
00123
00124 $oWrapping->setLanguage(0);
00125 $oWrapping->assign($aParams);
00126 $oWrapping->setLanguage($this->_iEditLang);
00127
00128 $oWrapping = oxRegistry::get("oxUtilsFile")->processFiles($oWrapping);
00129 $oWrapping->save();
00130
00131
00132 $this->setEditObjectId($oWrapping->getId());
00133 }
00134 }