ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç lang/en/datafield_textarea.php000064400000003163152267101610012416 0ustar00. /** * Strings for component 'datafield_textarea', language 'en', branch 'master' * * @package datafield * @subpackage textarea * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['maxbytes'] = 'Maximum embedded file size (bytes)'; $string['maxbytes_desc'] = 'If set to zero will be unlimited by default'; $string['pluginname'] = 'Text area'; $string['fieldtypelabel'] = 'Text area'; $string['privacy:metadata'] = 'The Text area field component doesn\'t store any personal data; it uses tables defined in mod_data.'; $string['sample'] = '

This is a text area. It lets users enter long form text which spans over multiple lines.

You can choose the size of your text areas in rows and columns.

The text in a text area can be formatted, for example in bold, and also include links or images.

'; pix/icon.svg000064400000001065152267101610007020 0ustar00 version.php000064400000002236152267101610006746 0ustar00. /** * @package datafield * @subpackage textarea * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2025041400; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2025040800; // Requires this Moodle version. $plugin->component = 'datafield_textarea'; // Full name of the plugin (used for diagnostics) classes/privacy/provider.php000064400000006527152267101610012234 0ustar00. /** * Privacy Subsystem implementation for datafield_textarea. * * @package datafield_textarea * @copyright 2018 Carlos Escobedo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace datafield_textarea\privacy; use core_privacy\local\request\transform; use core_privacy\local\request\writer; use mod_data\privacy\datafield_provider; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for datafield_textarea implementing null_provider. * * @copyright 2018 Carlos Escobedo * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider, datafield_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason(): string { return 'privacy:metadata'; } /** * Exports data about one record in {data_content} table. * * @param \context_module $context * @param \stdClass $recordobj record from DB table {data_records} * @param \stdClass $fieldobj record from DB table {data_fields} * @param \stdClass $contentobj record from DB table {data_content} * @param \stdClass $defaultvalue pre-populated default value that most of plugins will use */ public static function export_data_content($context, $recordobj, $fieldobj, $contentobj, $defaultvalue) { $subcontext = [$recordobj->id, $contentobj->id]; $defaultvalue->content = writer::with_context($context) ->rewrite_pluginfile_urls($subcontext, 'mod_data', 'content', $contentobj->id, $defaultvalue->content); $defaultvalue->contentformat = $defaultvalue->content1; unset($defaultvalue->content1); $defaultvalue->field['autolink'] = transform::yesno($fieldobj->param1); $defaultvalue->field['rows'] = $fieldobj->param3; $defaultvalue->field['cols'] = $fieldobj->param2; if ($fieldobj->param5) { $defaultvalue->field['maxbytes'] = $fieldobj->param5; } writer::with_context($context)->export_data($subcontext, $defaultvalue); } /** * Allows plugins to delete locally stored data. * * @param \context_module $context * @param \stdClass $recordobj record from DB table {data_records} * @param \stdClass $fieldobj record from DB table {data_fields} * @param \stdClass $contentobj record from DB table {data_content} */ public static function delete_data_content($context, $recordobj, $fieldobj, $contentobj) { } }templates/textarea.mustache000064400000005527152267101610012124 0ustar00{{! This file is part of Moodle - http://moodle.org/ Moodle 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. Moodle 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 Moodle. If not, see . }} {{! @template datafield_textarea/textarea The purpose of this template is to enable the user to define a textarea field. Classes required for JS: * none Data attributes required for JS: * none Context variables required for this template: * name string The field's name. * description string The field's description. * required bool The field's requiredness. * param2 int The field's width in columns. * param3 int The field's height in rows. * param5 int The field's attached files maxsize. Example context (json): { "name": "A name", "description": "A description", "required": true, "param2": 60, "param3": 35, "param5": 4096 } }}
{{> mod_data/fields/basicfields }} {{> mod_data/fields/requiredfield }}
{{#str}}columns, data{{/str}}
{{#str}}rows, data{{/str}}
{{#str}}maxbytes_desc, datafield_textarea{{/str}}
field.class.php000064400000036043152267101610007453 0ustar00dirroot.'/lib/filelib.php'); require_once($CFG->dirroot.'/repository/lib.php'); class data_field_textarea extends data_field_base { var $type = 'textarea'; /** * Prefix for the field name to split field id and the random part. * @var string */ protected const RND_PREFIX = 'xZx'; /** * priority for globalsearch indexing * * @var int */ protected static $priority = self::LOW_PRIORITY; /** * The field name for the content field. * * @var string */ protected $fieldname = null; /** * Returns a random field name for the content field. * * @return string */ protected function get_content_field_name() { if ($this->fieldname === null) { $this->fieldname = sprintf( 'field_%s_%s%s', $this->field->id, self::RND_PREFIX, bin2hex(random_bytes(5)) ); } return $this->fieldname; } /** * Check if the given field name is the content field that contains the actual data. * * @param string $name * @return bool */ protected function is_content_field(string $name): bool { return (strlen($name) === 13 && substr($name, 0, 3) === self::RND_PREFIX); } public function supports_preview(): bool { return true; } public function get_data_content_preview(int $recordid): stdClass { return (object)[ 'id' => 0, 'fieldid' => $this->field->id, 'recordid' => $recordid, 'content' => get_string('sample', 'datafield_textarea'), 'content1' => 1, 'content2' => null, 'content3' => null, 'content4' => null, ]; } /** * Returns options for embedded files * * @return array */ private function get_options() { if (!isset($this->field->param5)) { $this->field->param5 = 0; } $options = array(); $options['trusttext'] = false; $options['forcehttps'] = false; $options['subdirs'] = false; $options['maxfiles'] = -1; $options['context'] = $this->context; $options['maxbytes'] = $this->field->param5; $options['changeformat'] = 0; $options['noclean'] = false; return $options; } function display_add_field($recordid = 0, $formdata = null) { global $CFG, $DB, $OUTPUT, $PAGE; $text = ''; $format = 0; $str = '
'; $str .= ''; editors_head_setup(); $options = $this->get_options(); $itemid = $this->field->id; $field = 'field_'.$itemid; if ($formdata) { $fieldname = 'field_' . $this->field->id . '_content1'; if (isset($formdata->$fieldname)) { $format = $formdata->$fieldname; } else { $format = file_get_unused_draft_itemid(); } $fieldname = 'field_' . $this->field->id . '_itemid'; if (isset($formdata->$fieldname)) { $draftitemid = clean_param($formdata->$fieldname, PARAM_INT); } else { $draftitemid = file_get_unused_draft_itemid(); } $fieldname = 'field_' . $this->field->id . '_' . self::RND_PREFIX; foreach (array_keys(get_object_vars($formdata)) as $prop) { if (strpos($prop, $fieldname) === 0) { $text = $formdata->$prop; break; } } } else if ($recordid && $content = $DB->get_record('data_content', array('fieldid' => $this->field->id, 'recordid' => $recordid))) { $format = $content->content1; $text = clean_text($content->content, $format); $text = file_prepare_draft_area($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $text); } else { $draftitemid = file_get_unused_draft_itemid(); $format = editors_get_preferred_format(); } // get filepicker info // $fpoptions = array(); if ($options['maxfiles'] != 0 ) { $args = new stdClass(); // need these three to filter repositories list $args->accepted_types = array('web_image'); $args->return_types = (FILE_INTERNAL | FILE_EXTERNAL); $args->context = $this->context; $args->env = 'filepicker'; // advimage plugin $image_options = initialise_filepicker($args); $image_options->context = $this->context; $image_options->client_id = uniqid(); $image_options->maxbytes = $options['maxbytes']; $image_options->env = 'editor'; $image_options->itemid = $draftitemid; // moodlemedia plugin $args->accepted_types = array('video', 'audio'); $media_options = initialise_filepicker($args); $media_options->context = $this->context; $media_options->client_id = uniqid(); $media_options->maxbytes = $options['maxbytes']; $media_options->env = 'editor'; $media_options->itemid = $draftitemid; // advlink plugin $args->accepted_types = '*'; $link_options = initialise_filepicker($args); $link_options->context = $this->context; $link_options->client_id = uniqid(); $link_options->maxbytes = $options['maxbytes']; $link_options->env = 'editor'; $link_options->itemid = $draftitemid; // Subtitles, for multimedia. $args->accepted_types = ['.vtt']; $subtitleoptions = initialise_filepicker($args); $subtitleoptions->context = $this->context; $subtitleoptions->client_id = uniqid(); $subtitleoptions->maxbytes = $options['maxbytes']; $subtitleoptions->env = 'editor'; $subtitleoptions->itemid = $draftitemid; // H5P plugin. $args->accepted_types = ['h5p']; $h5poptions = initialise_filepicker($args); $h5poptions->context = $this->context; $h5poptions->client_id = uniqid(); $h5poptions->maxbytes = $options['maxbytes']; $h5poptions->env = 'editor'; $h5poptions->itemid = $draftitemid; $fpoptions['image'] = $image_options; $fpoptions['media'] = $media_options; $fpoptions['link'] = $link_options; $fpoptions['subtitle'] = $subtitleoptions; $fpoptions['h5p'] = $h5poptions; } $editor = editors_get_preferred_editor($format); $strformats = format_text_menu(); $formats = $editor->get_supported_formats(); foreach ($formats as $fid) { $formats[$fid] = $strformats[$fid]; } $editor->set_text($text); $editor->use_editor($this->get_content_field_name(), $options, $fpoptions); $str .= ''; $str .= '
'; $str .= '
'; $str .= '
'; $str .= ''; $str .= '
'; $str .= '
'; $str .= '
'; return $str; } function display_search_field($value = '') { return '' . ''; } public function parse_search_field($defaults = null) { $param = 'f_'.$this->field->id; if (empty($defaults[$param])) { $defaults = array($param => ''); } return optional_param($param, $defaults[$param], PARAM_NOTAGS); } function generate_sql($tablealias, $value) { global $DB; static $i=0; $i++; $name = "df_textarea_$i"; return array(" ({$tablealias}.fieldid = {$this->field->id} AND ".$DB->sql_like("{$tablealias}.content", ":$name", false).") ", array($name=>"%$value%")); } function print_after_form() { } function update_content($recordid, $value, $name='') { global $DB; $content = new stdClass(); $content->fieldid = $this->field->id; $content->recordid = $recordid; $names = explode('_', $name); if (!empty($names[2])) { if ($names[2] == 'itemid') { // the value will be retrieved by file_get_submitted_draft_itemid, do not need to save in DB return true; } else if ($this->is_content_field($names[2])) { $content->content = clean_param($value, PARAM_RAW_TRIMMED); } else { $content->{$names[2]} = clean_param($value, PARAM_NOTAGS); // content[1-4] } } else { $content->content = clean_param($value, PARAM_RAW_TRIMMED); } if ($oldcontent = $DB->get_record('data_content', array('fieldid'=>$this->field->id, 'recordid'=>$recordid))) { $content->id = $oldcontent->id; } else { $content->id = $DB->insert_record('data_content', $content); if (!$content->id) { return false; } } if (!empty($content->content)) { $draftitemid = file_get_submitted_draft_itemid('field_'. $this->field->id. '_itemid'); $options = $this->get_options(); $content->content = file_save_draft_area_files($draftitemid, $this->context->id, 'mod_data', 'content', $content->id, $options, $content->content); } $rv = $DB->update_record('data_content', $content); return $rv; } /** * Display the content of the field in browse mode * * @param int $recordid * @param object $template * @return bool|string */ function display_browse_field($recordid, $template) { $content = $this->get_data_content($recordid); if (!$content || !isset($content->content)) { return ''; } $options = new stdClass(); if ($this->field->param1 == '1') { // We are autolinking this field, so disable linking within us. $options->filter = false; } $options->para = false; $str = file_rewrite_pluginfile_urls( $content->content, 'pluginfile.php', $this->context->id, 'mod_data', 'content', $content->id, $this->get_options() ); $str = format_text($str, $content->content1, $options); return '
' . $str . '
'; } /** * Whether this module support files * * @param string $relativepath * @return bool */ function file_ok($relativepath) { return true; } /** * Only look at the first item (second is format) * * @param string $value * @param string $name * @return bool */ function notemptyfield($value, $name) { $names = explode('_', $name); // Clean first. if (count($names) == 2) { // Don't assume that this is coming from a text editor with tags. return strval($value) !== ''; } if ($this->is_content_field($names[2])) { return strval($value) !== ''; } return false; } /** * Returns the presentable string value for a field content. * * The returned string should be plain text. * * @param stdClass $content * @return string */ public static function get_content_value($content) { return content_to_text($content->content, $content->content1); } /** * Return the plugin configs for external functions. * * @return array the list of config parameters * @since Moodle 3.3 */ public function get_config_for_external() { // Return all the config parameters. $configs = []; for ($i = 1; $i <= 10; $i++) { $configs["param$i"] = $this->field->{"param$i"}; } return $configs; } }