Go to the documentation of this file.00001 <?php
00002
00009 class Attribute_Main extends oxAdminDetails
00010 {
00011
00018 public function render()
00019 {
00020 parent::render();
00021
00022 $myConfig = $this->getConfig();
00023
00024 $oAttr = oxNew("oxattribute");
00025 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00026
00027
00028 if ($soxId != "-1" && isset($soxId)) {
00029
00030 $this->_createCategoryTree("artcattree", $soxId);
00031
00032 $oAttr->loadInLang($this->_iEditLang, $soxId);
00033
00034
00035 $oOtherLang = $oAttr->getAvailableInLangs();
00036 if (!isset($oOtherLang[$this->_iEditLang])) {
00037
00038 $oAttr->loadInLang(key($oOtherLang), $soxId);
00039 }
00040
00041
00042 $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00043 if (count($aLang)) {
00044 $this->_aViewData["posslang"] = $aLang;
00045 }
00046
00047 foreach ($oOtherLang as $id => $language) {
00048 $oLang = new stdClass();
00049 $oLang->sLangDesc = $language;
00050 $oLang->selected = ($id == $this->_iEditLang);
00051 $this->_aViewData["otherlang"][$id] = clone $oLang;
00052 }
00053 }
00054
00055 $this->_aViewData["edit"] = $oAttr;
00056
00057 if ($myConfig->getRequestParameter("aoc")) {
00058 $oAttributeMainAjax = oxNew('attribute_main_ajax');
00059 $this->_aViewData['oxajax'] = $oAttributeMainAjax->getColumns();
00060
00061 return "popups/attribute_main.tpl";
00062 }
00063
00064 return "attribute_main.tpl";
00065 }
00066
00072 public function save()
00073 {
00074 parent::save();
00075
00076 $soxId = $this->getEditObjectId();
00077 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00078
00079
00080 $aParams['oxattribute__oxshopid'] = oxRegistry::getSession()->getVariable("actshop");
00081 $oAttr = oxNew("oxattribute");
00082
00083 if ($soxId != "-1") {
00084 $oAttr->loadInLang($this->_iEditLang, $soxId);
00085 } else {
00086 $aParams['oxattribute__oxid'] = null;
00087
00088 }
00089
00090
00091 $oAttr->setLanguage(0);
00092 $oAttr->assign($aParams);
00093 $oAttr->setLanguage($this->_iEditLang);
00094 $oAttr = oxRegistry::get("oxUtilsFile")->processFiles($oAttr);
00095 $oAttr->save();
00096
00097 $this->setEditObjectId($oAttr->getId());
00098 }
00099
00105 public function saveinnlang()
00106 {
00107 parent::save();
00108
00109 $soxId = $this->getEditObjectId();
00110 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00111
00112
00113 $aParams['oxattribute__oxshopid'] = oxRegistry::getSession()->getVariable("actshop");
00114 $oAttr = oxNew("oxattribute");
00115
00116 if ($soxId != "-1") {
00117 $oAttr->loadInLang($this->_iEditLang, $soxId);
00118 } else {
00119 $aParams['oxattribute__oxid'] = null;
00120 }
00121
00122
00123 $oAttr->setLanguage(0);
00124 $oAttr->assign($aParams);
00125
00126
00127 $oAttr->setLanguage(oxRegistry::getConfig()->getRequestParameter("new_lang"));
00128 $oAttr->save();
00129
00130
00131 $this->setEditObjectId($oAttr->getId());
00132 }
00133 }