function eavFormTextareaWysiwyg(Database_Mapper_Result $attributes) { // Add Wysiwyg initialization function to View object $script = htmlJS('tinymce.min', 'js/administrator/tinymce'); $script .= '<script type="text/javascript">'; $script .= '$(function() {'; $script .= 'tinymce.init({selector:"textarea[name=content]",content_css:"/css/default/tinymce.css?"+new Date().getTime()});'; $script .= '});'; $script .= '</script>'; return $script . eavFormTextarea($attributes); }
/** * The alias of helper function htmlJS() for simple using in views. * Default script folder is WEB-ROOT/js/ * @param string $file * @param string $folder * @return View_Helper_Html */ public function js($file, $folder = 'js') { if (is_array($file)) { foreach ($file as $f) { $this->js($f, $folder); } } else { $path = exido_fix_path($folder) . $file . '.js'; self::$_js[$file] = $path; print htmlJS($file, $folder); } return $this; }
/** * Prints or returns a HTML javascript include tag. First param is the file name. * Second param is the directory where javascript file is located. * If the first param is an array, function prints all an array elements * as javascript include tags. * @param string $js * @param string $folder * @return string */ function htmlJS($js, $folder = '') { if (is_array($js)) { foreach ($js as $file => $folder) { print htmlJS($file, $folder); } return ''; } if (empty($folder)) { return ''; } return '<script src="' . exido_fix_path($folder) . $js . '.js"></script>' . EXIDO_EOL; }