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