tinymce-editor/copy_this/modules/hdi/hdi-tinymce/tinymce.php

55 lignes
2.3 KiB
PHP
Brut Vue normale Historique

2012-11-10 23:18:09 +01:00
<?php
/**
* HDI TinyMCE
* Copyright (C) 2012 HEINER DIRECT GmbH & Co. KG
* info: info@heiner-direct.com
*
* This program is free software;
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
* either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
*/
class tinyMCE extends tinyMCE_parent {
protected function _generateTextEditor($iWidth, $iHeight, $oObject, $sField, $sStylesheet = null) {
$myConfig = $this->getConfig();
$sConfigParam = "bTinyMCE_" . $this->getClassName();
//check if tinyMCE is active for this calss
if ($myConfig->getConfigParam($sConfigParam) === true) {
$oViewConf = $this->_aViewData["oViewConf"];
$smarty = oxUtilsView::getInstance()->getSmarty();
//$sEditor = $smarty->fetch($myConfig->getModulesDir()."hdi/hdi-tinymce/test.tpl");
if ($oObject) {
$sInitialValue = '';
if ($oObject->$sField instanceof oxField) {
$sInitialValue = $oObject->$sField->getRawValue();
} else {
$sInitialValue = $oObject->$sField->value;
}
//$oObject->$sField = new oxField(str_replace('[{$shop->currenthomedir}]', $myConfig->getCurrentShopURL(), $sInitialValue), oxField::T_RAW);
$smarty->assign( "sField", $sField);
$smarty->assign( "iWidth", (strpos($iWidth, '%') === false) ? $iWidth . 'px' : $iWidth);
$smarty->assign( "iHeight", "80%");
//$smarty->assign( "iHeight", (strpos($iHeight, '%') === false) ? $iHeight . 'px' : $iHeight);
$smarty->assign( "sContent", $this->_getEditValue($oObject, $sField));
//var_dump($myConfig->getModulesDir()."hdi/hdi-tinymce/test.tpl");
$smarty->assign( "cfg", $myConfig);
$smarty->assign( "oViewConf", $this->_aViewData["oViewConf"]);
$sEditor = $smarty->fetch("tinymce.tpl");
}
return $sEditor;
} else {
//returning default textarea or whatever
return parent::_generateTextEditor($iWidth, $iHeight, $oObject, $sField, $sStylesheet);
}
}
}