Go to the documentation of this file.00001 <?php
00002
00009 class Actions_Main extends oxAdminDetails
00010 {
00011
00018 public function render()
00019 {
00020 parent::render();
00021
00022
00023 $soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
00024 if ($soxId != "-1" && isset($soxId)) {
00025
00026 $oAction = oxNew("oxactions");
00027 $oAction->loadInLang($this->_iEditLang, $soxId);
00028
00029 $oOtherLang = $oAction->getAvailableInLangs();
00030 if (!isset($oOtherLang[$this->_iEditLang])) {
00031
00032 $oAction->loadInLang(key($oOtherLang), $soxId);
00033 }
00034
00035 $this->_aViewData["edit"] = $oAction;
00036
00037
00038 $aLang = array_diff(oxRegistry::getLang()->getLanguageNames(), $oOtherLang);
00039
00040 if (count($aLang)) {
00041 $this->_aViewData["posslang"] = $aLang;
00042 }
00043
00044 foreach ($oOtherLang as $id => $language) {
00045 $oLang = new stdClass();
00046 $oLang->sLangDesc = $language;
00047 $oLang->selected = ($id == $this->_iEditLang);
00048 $this->_aViewData["otherlang"][$id] = clone $oLang;
00049 }
00050 }
00051
00052 if (oxRegistry::getConfig()->getRequestParameter("aoc")) {
00053
00054 $this->_createCategoryTree("artcattree", $soxId);
00055
00056 $oActionsMainAjax = oxNew('actions_main_ajax');
00057 $this->_aViewData['oxajax'] = $oActionsMainAjax->getColumns();
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 = oxRegistry::getConfig()->getRequestParameter("oxpromotionaoc")) {
00066 $sPopup = false;
00067 switch ($iAoc) {
00068 case 'article':
00069
00070 $this->_createCategoryTree("artcattree", $soxId);
00071
00072 if ($oArticle = $oPromotion->getBannerArticle()) {
00073 $this->_aViewData['actionarticle_artnum'] = $oArticle->oxarticles__oxartnum->value;
00074 $this->_aViewData['actionarticle_title'] = $oArticle->oxarticles__oxtitle->value;
00075 }
00076
00077 $sPopup = 'actions_article';
00078 break;
00079 case 'groups':
00080 $sPopup = 'actions_groups';
00081 break;
00082 }
00083
00084 if ($sPopup) {
00085 $aColumns = array();
00086 $oActionsArticleAjax = oxNew($sPopup . '_ajax');
00087 $this->_aViewData['oxajax'] = $oActionsArticleAjax->getColumns();
00088
00089 return "popups/{$sPopup}.tpl";
00090 }
00091 } else {
00092 if ($oPromotion->oxactions__oxtype->value == 2) {
00093 $this->_aViewData["editor"] = $this->_generateTextEditor(
00094 "100%",
00095 300,
00096 $oPromotion,
00097 "oxactions__oxlongdesc",
00098 "details.tpl.css"
00099 );
00100 }
00101 }
00102 }
00103 }
00104
00105 return "actions_main.tpl";
00106 }
00107
00108
00114 public function save()
00115 {
00116 $myConfig = $this->getConfig();
00117
00118
00119 parent::save();
00120
00121 $soxId = $this->getEditObjectId();
00122 $aParams = oxRegistry::getConfig()->getRequestParameter("editval");
00123
00124 $oPromotion = oxNew("oxactions");
00125 if ($soxId != "-1") {
00126 $oPromotion->load($soxId);
00127 } else {
00128 $aParams['oxactions__oxid'] = null;
00129 }
00130
00131 if (!$aParams['oxactions__oxactive']) {
00132 $aParams['oxactions__oxactive'] = 0;
00133 }
00134
00135 $oPromotion->setLanguage(0);
00136 $oPromotion->assign($aParams);
00137 $oPromotion->setLanguage($this->_iEditLang);
00138 $oPromotion = oxRegistry::get("oxUtilsFile")->processFiles($oPromotion);
00139 $oPromotion->save();
00140
00141
00142 $this->setEditObjectId($oPromotion->getId());
00143 }
00144
00148 public function saveinnlang()
00149 {
00150 $this->save();
00151 }
00152 }