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 ( oxLang::getInstance()->getLanguageNames(), $oOtherLang );
00038
00039 if ( count( $aLang))
00040 $this->_aViewData["posslang"] = $aLang;
00041
00042 foreach ( $oOtherLang as $id => $language) {
00043 $oLang= new oxStdClass();
00044 $oLang->sLangDesc = $language;
00045 $oLang->selected = ($id == $this->_iEditLang);
00046 $this->_aViewData["otherlang"][$id] = clone $oLang;
00047 }
00048 }
00049 $aColumns = array();
00050
00051 if ( oxConfig::getParameter("aoc") ) {
00052
00053 $sChosenArtCat = oxConfig::getParameter( "artcat");
00054 $sChosenArtCat = $this->_getCategoryTree( "artcattree", $sChosenArtCat, $soxId);
00055
00056 include_once 'inc/'.strtolower(__CLASS__).'.inc.php';
00057 $this->_aViewData['oxajax'] = $aColumns;
00058
00059 return "popups/actions_main.tpl";
00060 }
00061
00062
00063 if ( ( $oPromotion = $this->getViewDataElement( "edit" ) ) ) {
00064 if ( ($oPromotion->oxactions__oxtype->value == 2) || ($oPromotion->oxactions__oxtype->value == 3) ) {
00065 if ( $iAoc = oxConfig::getParameter( "oxpromotionaoc" ) ) {
00066 $sPopup = false;
00067 switch( $iAoc ) {
00068 case 'article':
00069
00070 $sChosenArtCat = oxConfig::getParameter( "artcat");
00071 $sChosenArtCat = $this->_getCategoryTree( "artcattree", $sChosenArtCat, $soxId);
00072
00073 if ($oArticle = $oPromotion->getBannerArticle()) {
00074 $this->_aViewData['actionarticle_artnum'] = $oArticle->oxarticles__oxartnum->value;
00075 $this->_aViewData['actionarticle_title'] = $oArticle->oxarticles__oxtitle->value;
00076 }
00077
00078 $sPopup = 'actions_article';
00079 break;
00080 case 'groups':
00081 $sPopup = 'actions_groups';
00082 break;
00083 }
00084
00085 if ( $sPopup ) {
00086 $aColumns = array();
00087 include_once "inc/{$sPopup}.inc.php";
00088 $this->_aViewData['oxajax'] = $aColumns;
00089 return "popups/{$sPopup}.tpl";
00090 }
00091 } else {
00092 if ( $oPromotion->oxactions__oxtype->value == 2) {
00093 $this->_aViewData["editor"] = $this->_generateTextEditor( "100%", 300, $oPromotion, "oxactions__oxlongdesc", "details.tpl.css" );
00094 }
00095 }
00096 }
00097 }
00098
00099 return "actions_main.tpl";
00100 }
00101
00102
00108 public function save()
00109 {
00110 $myConfig = $this->getConfig();
00111
00112
00113 $soxId = $this->getEditObjectId();
00114 $aParams = oxConfig::getParameter( "editval");
00115
00116 $oPromotion = oxNew( "oxactions" );
00117 if ( $soxId != "-1" ) {
00118 $oPromotion->load( $soxId );
00119
00120 oxUtilsPic::getInstance()->overwritePic( $oPromotion, 'oxactions', 'oxpic', 'PROMO', oxUtilsFile::PROMO_PICTURE_DIR, $aParams, $myConfig->getPictureDir(false));
00121
00122 } else {
00123 $aParams['oxactions__oxid'] = null;
00124 }
00125
00126 if ( !$aParams['oxactions__oxactive'] ) {
00127 $aParams['oxactions__oxactive'] = 0;
00128 }
00129
00130 $oPromotion->setLanguage( 0 );
00131 $oPromotion->assign( $aParams );
00132 $oPromotion->setLanguage( $this->_iEditLang );
00133 $oPromotion = oxUtilsFile::getInstance()->processFiles( $oPromotion );
00134 $oPromotion->save();
00135
00136
00137 $this->setEditObjectId( $oPromotion->getId() );
00138 }
00139
00145 public function saveinnlang()
00146 {
00147 $this->save();
00148 }
00149 }