MDL-52454 tool_lp: Fix all PARAM_TEXT on persistent, and exporters
This commit is contained in:
committed by
Frederic Massart
parent
357d38628c
commit
e54f8c4d2d
@@ -68,7 +68,7 @@ class competency extends persistent {
|
||||
),
|
||||
'description' => array(
|
||||
'default' => '',
|
||||
'type' => PARAM_TEXT
|
||||
'type' => PARAM_RAW
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
|
||||
|
||||
@@ -90,7 +90,7 @@ class competency_framework extends persistent {
|
||||
'type' => PARAM_TEXT
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_TEXT,
|
||||
'type' => PARAM_RAW,
|
||||
'default' => ''
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
+2
-3
@@ -144,7 +144,7 @@ abstract class exporter {
|
||||
|
||||
$data->$property = $record->$property;
|
||||
|
||||
// If the field is PARAM_TEXT and has a format field.
|
||||
// If the field is PARAM_RAW and has a format field.
|
||||
if ($propertyformat = self::get_format_field($properties, $property)) {
|
||||
if (!property_exists($record, $propertyformat)) {
|
||||
// Whoops, we got something that wasn't defined.
|
||||
@@ -155,7 +155,6 @@ abstract class exporter {
|
||||
$data->$property = $text;
|
||||
$data->$propertyformat = $format;
|
||||
|
||||
// If it's a PARAM_TEXT without format field.
|
||||
} else if ($definition['type'] === PARAM_TEXT) {
|
||||
if (!empty($definition['multiple'])) {
|
||||
foreach ($data->$property as $key => $value) {
|
||||
@@ -334,7 +333,7 @@ abstract class exporter {
|
||||
*/
|
||||
final protected static function get_format_field($definitions, $property) {
|
||||
$formatproperty = $property . 'format';
|
||||
if ($definitions[$property]['type'] == PARAM_TEXT && isset($definitions[$formatproperty])
|
||||
if ($definitions[$property]['type'] == PARAM_RAW && isset($definitions[$formatproperty])
|
||||
&& $definitions[$formatproperty]['type'] == PARAM_INT) {
|
||||
return $formatproperty;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class competency extends persistent {
|
||||
$mform->addRule('shortname', null, 'required', null, 'client');
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->addElement('text', 'idnumber',
|
||||
get_string('idnumber', 'tool_lp'));
|
||||
$mform->setType('idnumber', PARAM_TEXT);
|
||||
|
||||
@@ -60,7 +60,7 @@ class competency_framework extends persistent {
|
||||
$mform->addRule('shortname', null, 'required', null, 'client');
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->addElement('text', 'idnumber',
|
||||
get_string('idnumber', 'tool_lp'));
|
||||
$mform->setType('idnumber', PARAM_TEXT);
|
||||
|
||||
@@ -54,7 +54,7 @@ class plan extends persistent {
|
||||
$mform->setType('name', PARAM_TEXT);
|
||||
$mform->addRule('name', null, 'required', null, 'client');
|
||||
$mform->addElement('editor', 'description', get_string('plandescription', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
|
||||
$mform->addElement('date_time_selector', 'duedate', get_string('duedate', 'tool_lp'), array('optional' => true));
|
||||
$mform->addHelpButton('duedate', 'duedate', 'tool_lp');
|
||||
|
||||
@@ -56,7 +56,7 @@ class template extends persistent {
|
||||
$mform->addRule('shortname', null, 'required', null, 'client');
|
||||
$mform->addElement('editor', 'description',
|
||||
get_string('description', 'tool_lp'), array('rows' => 4));
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
$mform->addElement('selectyesno', 'visible',
|
||||
get_string('visible', 'tool_lp'));
|
||||
$mform->addElement('date_time_selector',
|
||||
|
||||
@@ -53,7 +53,7 @@ class user_evidence extends persistent {
|
||||
|
||||
$mform->addElement('editor', 'description', get_string('userevidencedescription', 'tool_lp'), array('rows' => 10));
|
||||
// TODO MDL-52454 Make PARAM_RAW.
|
||||
$mform->setType('description', PARAM_TEXT);
|
||||
$mform->setType('description', PARAM_RAW);
|
||||
|
||||
$mform->addElement('url', 'url', get_string('userevidenceurl', 'tool_lp'), array(), array('usefilepicker' => false));
|
||||
$mform->setType('url', PARAM_RAW_TRIMMED); // Can not use PARAM_URL, it silently converts bad URLs to ''.
|
||||
|
||||
@@ -232,8 +232,7 @@ abstract class persistent {
|
||||
$formatted = array();
|
||||
foreach ($properties as $property => $definition) {
|
||||
$propertyformat = $property . 'format';
|
||||
// TODO MDL-52454 Check PARAM_RAW.
|
||||
if ($definition['type'] == PARAM_TEXT && array_key_exists($propertyformat, $properties)
|
||||
if ($definition['type'] == PARAM_RAW && array_key_exists($propertyformat, $properties)
|
||||
&& $properties[$propertyformat]['type'] == PARAM_INT) {
|
||||
$formatted[$property] = $propertyformat;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class plan extends persistent {
|
||||
'type' => PARAM_TEXT,
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_TEXT,
|
||||
'type' => PARAM_RAW,
|
||||
'default' => ''
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
@@ -53,7 +53,7 @@ class template extends persistent {
|
||||
),
|
||||
'description' => array(
|
||||
'default' => '',
|
||||
'type' => PARAM_TEXT,
|
||||
'type' => PARAM_RAW,
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
'choices' => array(FORMAT_HTML, FORMAT_MOODLE, FORMAT_PLAIN, FORMAT_MARKDOWN),
|
||||
|
||||
@@ -53,7 +53,7 @@ class user_evidence extends persistent {
|
||||
'type' => PARAM_TEXT
|
||||
),
|
||||
'description' => array(
|
||||
'type' => PARAM_TEXT, // TODO MDL-52454 Make PARAM_RAW.
|
||||
'type' => PARAM_RAW,
|
||||
'default' => '',
|
||||
),
|
||||
'descriptionformat' => array(
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<p><strong>{{competency.shortname}} <em>{{competency.idnumber}}</em></strong></p>
|
||||
<p>{{competency.description}}</p>
|
||||
<p>{{{competency.description}}}</p>
|
||||
|
||||
{{#framework}}
|
||||
<p><strong>{{framework.shortname}}</strong></p>
|
||||
<p>{{framework.description}}</p>
|
||||
<p>{{{framework.description}}}</p>
|
||||
{{/framework}}
|
||||
|
||||
{{#showrelatedcompetencies}}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
{{/plan.template}}
|
||||
{{#description}}
|
||||
<dt>{{#str}}description{{/str}}</dt>
|
||||
<dd>{{plan.description}}</dd>
|
||||
<dd>{{{plan.description}}}</dd>
|
||||
{{/description}}
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div data-region="user-evidence-summary">
|
||||
{{#description}}
|
||||
<div>
|
||||
{{description}}
|
||||
{{{description}}}
|
||||
</div>
|
||||
{{/description}}
|
||||
<ul class="user-evidence-documents">
|
||||
|
||||
Reference in New Issue
Block a user