* @copyright Badiu
Fonte de pesquisa
https://docs.moodle.org/dev/Editor_API
https://stackoverflow.com/questions/32110051/how-can-i-use-tinymce-editor-outside-moodle-form
https://wimski.org/api/3.8/db/dcc/classtextarea__texteditor.html
https://hotexamples.com/pt/examples/-/-/editors_get_preferred_editor/php-editors_get_preferred_editor-function-examples.html
*/
require_once("../config.php");
require_once $CFG->dirroot.'/lib/form/editor.php';
require_once $CFG->dirroot . '/lib/editorlib.php';
require_login();
echo $OUTPUT->header();
echo "Editor attor no textares ";
$editor = \editors_get_preferred_editor(FORMAT_HTML);
$editor->use_editor("badiueditor1");
echo "";
echo "
Editor attor no textares com funcionalidades customizadas
";
$paramconf=array('atto:toolbar'=>'style1 = bold, italic'. PHP_EOL .'list = unorderedlist, orderedlist');
$editor = \editors_get_preferred_editor(FORMAT_HTML);
$editor->use_editor("badiueditor2",$paramconf);
echo "";
echo "
Editor attor no textares com acesso ao gerenciamento de arquivos
";
$context = context_system::instance();
$paramconf = array('subdirs' => 0,'maxbytes' => 0,'maxfiles' => -1,'context' => $context,'noclean' => 0,'trusttext' => 0);
$linkoptions=new stdClass();
$linkoptions = initialise_filepicker('*');
$linkoptions->context = $context;
$linkoptions->client_id = uniqid();
$linkoptions->maxbytes =1024;
$linkoptions->areamaxbytes = 1024;
$linkoptions->env = 'editor';
$linkoptions->itemid = 134;
$imageoptions=new stdClass();
$imageoptions = initialise_filepicker('*');
$imageoptions->context = $context;
$imageoptions->client_id = uniqid();
$imageoptions->maxbytes = 1204;
$imageoptions->areamaxbytes = 1024;
$imageoptions->env = 'editor';
$imageoptions->itemid = 134;
$optionconfig=array();
$optionconfig['image']=$imageoptions;
$optionconfig['link']=$linkoptions;
$editor = \editors_get_preferred_editor(FORMAT_HTML);
$editor->use_editor("badiueditor3",$paramconf,$optionconfig);
echo "";
echo $OUTPUT->footer();