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