Go to the documentation of this file.00001 <?php
00002
00009 class Actions_Main extends oxAdminDetails
00010 {
00017 public function render()
00018 {
00019 parent::render();
00020
00021
00022 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00023 if ( $soxId != "-1" && isset( $soxId)) {
00024
00025 $oAction = oxNew( "oxactions" );
00026 $oAction->loadInLang( $this->_iEditLang, $soxId);
00027
00028 $oOtherLang = $oAction->getAvailableInLangs();
00029 if (!isset($oOtherLang[$this->_iEditLang])) {
00030
00031 $oAction->loadInLang( key($oOtherLang), $soxId );
00032 }
00033
00034 $this->_aViewData["edit"] = $oAction;
00035
00036
00037 $aLang = array_diff ( oxRegistry::getLang()->getLanguageNames(), $oOtherLang );
00038
00039 if ( count( $aLang))
00040 $this->_aViewData["posslang"] = $aLang;
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 if ( oxConfig::getParameter("aoc") ) {
00051
00052 $this->_createCategoryTree( "artcattree", $soxId);
00053
00054 $oActionsMainAjax = oxNew( 'actions_main_ajax' );
00055 $this->_aViewData['oxajax'] = $oActionsMainAjax->getColumns();
00056
00057 return "popups/actions_main.tpl";
00058 }
00059
00060
00061 if ( ( $oPromotion = $this->getViewDataElement( "edit" ) ) ) {
00062 if ( ($oPromotion->oxactions__oxtype->value == 2) || ($oPromotion->oxactions__oxtype->value == 3) ) {
00063 if ( $iAoc = oxConfig::getParameter( "oxpromotionaoc" ) ) {
00064 $sPopup = false;
00065 switch( $iAoc ) {
00066 case 'article':
00067
00068 $this->_createCategoryTree( "artcattree", $soxId);
00069
00070 if ($oArticle = $oPromotion->getBannerArticle()) {
00071 $this->_aViewData['actionarticle_artnum'] = $oArticle->oxarticles__oxartnum->value;
00072 $this->_aViewData['actionarticle_title'] = $oArticle->oxarticles__oxtitle->value;
00073 }
00074
00075 $sPopup = 'actions_article';
00076 break;
00077 case 'groups':
00078 $sPopup = 'actions_groups';
00079 break;
00080 }
00081
00082 if ( $sPopup ) {
00083 $aColumns = array();
00084 $oActionsArticleAjax = oxNew( $sPopup.'_ajax' );
00085 $this->_aViewData['oxajax'] = $oActionsArticleAjax->getColumns();
00086 return "popups/{$sPopup}.tpl";
00087 }
00088 } else {
00089 if ( $oPromotion->oxactions__oxtype->value == 2) {
00090 $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oPromotion, "oxactions__oxlongdesc", "details.tpl.css" );
00091 }
00092 }
00093 }
00094 }
00095
00096 return "actions_main.tpl";
00097 }
00098
00099
00105 public function save()
00106 {
00107 $myConfig = $this->getConfig();
00108
00109
00110 parent::save();
00111
00112 $soxId = $this->getEditObjectId();
00113 $aParams = oxConfig::getParameter( "editval");
00114
00115 $oPromotion = oxNew( "oxactions" );
00116 if ( $soxId != "-1" ) {
00117 $oPromotion->load( $soxId );
00118 } else {
00119 $aParams['oxactions__oxid'] = null;
00120 }
00121
00122 if ( !$aParams['oxactions__oxactive'] ) {
00123 $aParams['oxactions__oxactive'] = 0;
00124 }
00125
00126 $oPromotion->setLanguage( 0 );
00127 $oPromotion->assign( $aParams );
00128 $oPromotion->setLanguage( $this->_iEditLang );
00129 $oPromotion = oxRegistry::get("oxUtilsFile")->processFiles( $oPromotion );
00130 $oPromotion->save();
00131
00132
00133 $this->setEditObjectId( $oPromotion->getId() );
00134 }
00135
00141 public function saveinnlang()
00142 {
00143 $this->save();
00144 }
00145 }