Skip to content

Commit

Permalink
This PR contains the content of three major improvements achieved in …
Browse files Browse the repository at this point in the history
…the last two months.

Those three improvements can be described as follows:

1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).
        This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).
        I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.
        In practice: the method, named in master "item_add_mandatory_base_fields" was renamed in the branch to "item_add_defaults_for_base_fields".
        By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.
        I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.

2. translation of the most frequent properties (among all item plugins) from the specific item plugin tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).
        This second step is clearly the natural continuation of the previous one and, for this reason, I created this new branch (https://github.com/kordan/moodle-mod_surveypro/tree/others_to_base_property) on top of content_among_basics.

3. Once I had a clear idea of how the itemplugin attributes were managed, I finally proceeded to adapt surveypro to php8.2 by creating the php8.2 branch.
        Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.

   The outcome of "content_among_basics" is described in (1).
   The outcome of "others_to_base_property" is described in (2).
   The outcome of "php8.2" is described in (3).

=====================================================
(1) Content and contentformat moved among base fields

As part of a work of standardization and modernization of the module aimed at making the code homogeneous and, consequently, easily understandable and modifiable, I realized that the use of PHP 8.2 highlights a significant and very long series of errors that I must absolutely address.
The first error among these is that the class of each item (item = fields + format) must have its own properties that it must manage on its own. But to define the list of properties of each item I have to decide which properties to consider "common" to all items and which to consider "specific" to each individual item.
There are two reflections related to this problem:
- Theoretically there are very few properties common to all items. Among these I only see: hidden, insearchform and reserved. All the others cannot be common to ALL items because, for example, the "pagebreak" item only has these three properties just mentioned;
I already accepted this "lack" of properties ACTUALLY common to all items when I chose to create the itemsetup form (the form to setup a new item for the surveypro) from the union of a "item_setupbaseform" and an "itemsetupform".
The item_setupbaseform has the fields it has and each item has a rule that says what it wants in its form and what it doesn't want to appear. (Each item defines a static vector called insetupform which declares what it wants to appear in the item_setupbaseform and what not. Obviously there is no similar vector for the specific form of each item because, having been created for the single item, it contains only and exclusively whatever you want.)
I therefore realize that the answer to the question: which properties must be classified as "common" to all items and which, instead, must be classified as "specific" of each individual item is in the list of fields that I included, 10 years ago, in the "item_setupbaseform" and in the "itemsetupform".
So in order to make the code more homogeneous and self-consistent, I have to start moving all the "common" fields from the tables of each individual item ('surveypro'.$type.'_'.$plugin) to the surveypro_item table.

    The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.

- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:
    -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;
    -- upgrade your surveypro;
    -- regenerate each usertemplate and each mastertemplate.
    obviously the next PR I will make will relate to moving the other "common" properties from the specific tables to the surveypro_item table (and I will create them on top of this one).

=====================================================
(2) Each common propery is now saved to surveypro_item

When "content_among_basics" (that saves content and contentformat to surveypro_item and no longer into db tables of item plugins) and this PR will land to mastwer, I hope all will be ready to start to modify surveypro to let it correctly run in php8.2 and 8.3.

With this PR the situation of properties should be:
```
                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON   | RATE            | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
id (h)           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
surveyproid (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
type (h)         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
plugin (h)       | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

content          | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | NO          | √         | NO        |
contentformat    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |

required         | √             | NO          | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
indent           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
position         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
customnumber     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | √         | NO        |
hideinstructions | √             | NO          | NO             | √            | √               | √              | √              | NO         | √             | √               | √             | NO            | √               | √              | NO             | √              | √          | √              | NO            | NO          | NO        | NO        |

variable         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |
extranote        | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | NO            | NO          | NO        | NO        |

hidden           | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
insearchform     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
reserved         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

sortindex (h)    | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
formpage (h)     | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

parentid         | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
parentvalue      | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |

timecreated (h)  | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
timemodified (h) | √             | √           | √              | √            | √               | √              | √              | √          | √             | √               | √             | √             | √               | √              | √              | √              | √          | √              | √             | √           | √         | √         |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
```
All the properties in the first column are relative to a field of the table surveypro_item.
All the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.
Not all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[<property>] = (false|true);
If $this->insetupform[<property>] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).
Marked with (h) are properties hidden to user.

In the next table the list of specific properties item per item.
These properties are save in surveypro(field|format)_<plugin>.
Yes, some of them coincide, but the number of plugins sharing the same property is too low and even the semantic is too specific of each single plugin so
I decided to save these properties among the fields of the child table and not in surveypro_item.
```
                 | AGE           | AUTOFILL    | BOOLEAN        | CHARACTER    | CHECKBOX        | DATE           | DATETIME       | FILEUPLOAD | INTEGER       | MULTISELECT     | NUMERIC       | RADIOBUTTON    | RATE           | RECURRENCE     | SELECT         | SHORTDATE      | TEXTAREA   | TIME           | FIELDSET      | FIELDSETEND | LABEL     | PAGEBREAK |
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
                 | defaultoption | hiddenfield | defaultoption  | trimonsave   | options         | defaultoption  | step           | maxfiles   | defaultoption | options         | defaultvalue  | options        | options        | defaultoption  | options        | defaultoption  | trimonsave | step           | defaultstatus |             | fullwidth |
                 | defaultvalue  | element01   | defaultvalue   | defaultvalue | labelother      | defaultvalue   | defaultvalue   | maxbytes   | defaultvalue  | defaultvalue    | signed        | labelother     | rates          | defaultvalue   | labelother     | defaultvalue   | useeditor  | defaultoption  |                             | leftlabel |
                 | lowerbound    | element02   | downloadformat | pattern      | defaultvalue    | downloadformat | defaultvalue   | filetypes  | lowerbound    | noanswerdefault | lowerbound    | defaultoption  | defaultoption  | downloadformat | defaultoption  | downloadformat | arearows   | defaultvalue   |
                 | upperbound    | element03   | style          | minlength    | noanswerdefault | lowerbound     | downloadformat |            | upperbound    | downloadformat  | upperbound    | defaultvalue   | defaultvalue   | lowerbound     | defaultvalue   | lowerbound     | areacols   | downloadformat |
                                 | element04   |                | maxlength    | downloadformat  | upperbound     | lowerbound     |                            | minimumrequired | decimals      | downloadformat | downloadformat | upperbound     | downloadformat | upperbound     | minlength  | lowerbound     |
                                 | element05   |                               | minimumrequired |                | upperbound     |                            | maximumrequired |               | adjustment     | style          |                                                  | maxlength  | upperbound     |
                                                                               | maximumrequired |                                                              | heightinrows    |                                | differentrates |
                                                                               | adjustment      |
```

=====================================================
(3) php8.2
This improvement makes surveypro compatible with php8.2.
There is some small problem, however, that I don't understand and which, for this reason, I describe below.

(a) I see a theoretical problem that I believe is closely related to my request for help in: https://moodle.org/mod/forum/discuss.php?d=457241

The problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.
One of the properties common to all surveypro items is "content" (alias, the content of the question) followed by the content_format. To define an item via the corresponding form at submission time, the HTML editor is processed through
file_prepare_standard_editor that changes the content_editor property. When I pass the object $item to the file_prepare_standard_editor method, php8.2 raises an exception claiming that the content_editor property (that I must have defined previously) and that I have defined as protected cannot be modified because it is protected. I know it is a good practice to always define properties as protected so my question is: How should I behave? Do I have to make the property public?

(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.
```
FILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php
  93 | ERROR   | [x] Member variable "content_editor" must not contain underscores.
     |         |     (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)
1128 | ERROR   | [x] Variable "content_editor" must not contain underscores.
     |         |     (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)
1129 | ERROR   | [x] Variable "content_editor" must not contain underscores.
     |         |     (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)
```

(c) In php8.2 and moodle master, I frequently get the error "Javascript code and/or AJAX requests are not ready after 10 seconds".
At my eyes, it seems related to TinyMCE editor. Executing a submission of the item_setupbaseform with values that inhibit the submission itself, when the form is reloaded it is impossible to paste something in the content textarea.

(d) I'm having a problem with style sheets.
Moodle 4.4 defines the style class:

```
.mb-3, .my-3 {
   margin-bottom: 1rem !important;
}
```

To override this class I am forced to use:

```
.path-mod-surveypro #userentry .mb-3,
.path-mod-surveypro #usersearch .mb-3 {
     margin-bottom: 0 !important;
}
```

specifying NECESSARILY !important to be able to override the parent class.

The "!important" specification, however, is classified by Grunt (in the context of the GHA) as an error:

```
mod/surveypro/styles.css
  28:22  ✖  Unexpected !important  declaration-no-important
 348:24  ✖  Unexpected !important  declaration-no-important
 356:24  ✖  Unexpected !important  declaration-no-important
 361:24  ✖  Unexpected !important  declaration-no-important
 366:22  ✖  Unexpected !important  declaration-no-important
 374:22  ✖  Unexpected !important  declaration-no-important
 379:22  ✖  Unexpected !important  declaration-no-important
 384:24  ✖  Unexpected !important  declaration-no-important
 392:24  ✖  Unexpected !important  declaration-no-important
 397:24  ✖  Unexpected !important  declaration-no-important
 402:22  ✖  Unexpected !important  declaration-no-important
 409:22  ✖  Unexpected !important  declaration-no-important
 414:22  ✖  Unexpected !important  declaration-no-important
 419:24  ✖  Unexpected !important  declaration-no-important
 426:24  ✖  Unexpected !important  declaration-no-important
 431:24  ✖  Unexpected !important  declaration-no-important
 436:22  ✖  Unexpected !important  declaration-no-important
 443:22  ✖  Unexpected !important  declaration-no-important
 448:22  ✖  Unexpected !important  declaration-no-important
 453:25  ✖  Unexpected !important  declaration-no-important
 460:25  ✖  Unexpected !important  declaration-no-important
 465:25  ✖  Unexpected !important  declaration-no-important
 470:23  ✖  Unexpected !important  declaration-no-important
 477:23  ✖  Unexpected !important  declaration-no-important
 482:23  ✖  Unexpected !important  declaration-no-important
 487:25  ✖  Unexpected !important  declaration-no-important
 494:25  ✖  Unexpected !important  declaration-no-important
 499:25  ✖  Unexpected !important  declaration-no-important

28 problems (28 errors, 0 warnings)
```
  • Loading branch information
kordan committed Jul 4, 2024
1 parent 4cdab91 commit 96968f8
Show file tree
Hide file tree
Showing 370 changed files with 17,524 additions and 10,547 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
matrix:
include:
- php: 8.1
moodle-branch: MOODLE_403_STABLE
moodle-branch: MOODLE_404_STABLE
database: mariadb
suite: classic
profile: default
- php: 8.1
moodle-branch: MOODLE_403_STABLE
- php: 8.2
moodle-branch: MOODLE_404_STABLE
database: pgsql
suite: default
profile: chrome
Expand Down
20 changes: 10 additions & 10 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
-> does it make sense the research per long text?
-> "Manage relation" page has lots of features, but the consequence is that the page is "cluttered" with too many settings.
-> "Manage relation" page has lots of features, but the consequence is that the page is "cluttered" with too many settings.
Obviously a Show/Hide advanced button is needed. (thanks to JR)
-> The Autofill question message "Content will be added at submit time" should not be displayed to the Student when taking the Survey,
-> The Autofill question message "Content will be added at submit time" should not be displayed to the Student taking the Survey,
as it does not mean anything to him. That is a message for Teacher, not Student. (thanks to JR)
-> grades?
-> surveypro_get_view_actions()?
-> surveypro_get_post_actions()?
-> surveypro_scale_used($surveyproid, $scaleid)?
-> surveypro_scale_used_anywhere($scaleid)?
-> unit test (they are a must)
-> *** Crucial known issue that is not fixable in my opinion. I apply a master template.
I make a surveypro with it. Tomorrow I update the master template with a newer version.
This new version has one more item in the middle.
Surveys built with the old release of the plugin will stop working fine as they will find in the right position string of a different template.
-> *** Crucial known issue that is not fixable in my opinion. I apply a master template.
I make a surveypro with it. Tomorrow I update the master template with a newer version.
This new version has one more item in the middle.
Surveys built with the old plugins will stop working fine as they will find in the right position string of a different template.
-> possible better solution: use the first 32 chars of the question escaped
-> is the autofill field saved to userdata even if it is not shown?
-> allow upperbound date/datetime == to now
Expand All @@ -21,7 +21,7 @@ Surveys built with the old release of the plugin will stop working fine as they
-> mform elements in MMM have different sizes probably because of /theme/yui_combo.php?
3.13.0/cssreset/cssreset.css&3.13.0/cssfonts/cssfonts.css&3.13.0/cssgrids/cssgrids.css&3.13.0/cssbase/cssbase.css

1) Still it seems to be something strange when handling fileareas.
1) Still it seems to be something strange when handling fileareas.
I just grepped by get_area_files and found a bunch of them new/strange for me. ELOY has to review this!
> Please let me know better what do you mean. I can not understand it.

Expand All @@ -31,15 +31,15 @@ I just grepped by get_area_files and found a bunch of them new/strange for me. E
> literals is ok.
> more yet, if there are groups... then everything (listing, reports, graphs)
> must be by group.
things like the "phantom tabs" (sorry for the expression, lol, just joking) or the way "attempts" are performed...
things like the "phantom tabs" (sorry for the expression, lol, just joking) or the way "attempts" are performed...
are substandard (to name it in some way).

2.a) A read me about what's missing (migration from old, usability review and discussion)

2.b) A commit (decided by you) where you want me to cut history.
2.b) A commit (decided by you) where you want me to cut history.
Can be current commit of anything else if you want to preserve your latest commits for any reason.

2.c) A BIG WARNING saying that it must not be used in production sites with existing old surveypros
2.c) A BIG WARNING saying that it must not be used in production sites with existing old surveypros
because they will be erased completely (beacuse of 1).
README.md (so it will display nicely in github) ?

Expand Down
20 changes: 12 additions & 8 deletions backup/moodle2/backup_surveypro_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,22 @@ protected function define_structure() {
// Define each element separated.
// Root element describing surveypro instance.
$surveypro = new backup_nested_element('surveypro', ['id'], [
'name', 'intro', 'introformat', 'newpageforchild', 'neverstartedemail',
'pauseresume', 'keepinprogress', 'captcha', 'history', 'anonymous',
'timeopen', 'timeclose', 'startyear', 'stopyear',
'maxentries', 'mailroles', 'mailextraaddresses', 'mailcontent', 'mailcontentformat',
'thankspage', 'thankspageformat', 'riskyeditdeadline', 'template', 'completionsubmit',
'timecreated', 'timemodified', ]);
'name', 'intro', 'introformat', 'newpageforchild', 'neverstartedemail',
'pauseresume', 'keepinprogress', 'captcha', 'history', 'anonymous',
'timeopen', 'timeclose', 'startyear', 'stopyear',
'maxentries', 'mailroles', 'mailextraaddresses', 'mailcontent', 'mailcontentformat',
'thankspage', 'thankspageformat', 'riskyeditdeadline', 'template', 'completionsubmit',
'timecreated', 'timemodified',
]);

$items = new backup_nested_element('items');

$item = new backup_nested_element('item', ['id', 'type', 'plugin'], [
'hidden', 'insearchform', 'reserved', 'sortindex', 'formpage',
'parentid', 'parentvalue', 'timecreated', 'timemodified', ]);
'content', 'contentformat',
'required', 'indent', 'position', 'customnumber', 'hideinstructions', 'variable', 'extranote',
'hidden', 'insearchform', 'reserved', 'sortindex', 'formpage',
'parentid', 'parentvalue', 'timecreated', 'timemodified',
]);

$submissions = new backup_nested_element('submissions');

Expand Down
2 changes: 1 addition & 1 deletion classes/event/submission_created.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function get_url() {
$paramurl['id'] = $this->contextinstanceid;
$paramurl['submissionid'] = $this->objectid;
$paramurl['mode'] = $this->other['mode'];
$paramurl['section'] = 'submissionform';
$paramurl['section'] = 'responsesubmit';
return new \moodle_url('/mod/surveypro/view.php', $paramurl);
}

Expand Down
2 changes: 1 addition & 1 deletion classes/event/submission_modified.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function get_url() {
$paramurl['id'] = $this->contextinstanceid;
$paramurl['submissionid'] = $this->objectid;
$paramurl['mode'] = $this->other['mode'];
$paramurl['section'] = 'submissionform';
$paramurl['section'] = 'responsesubmit';
return new \moodle_url('/mod/surveypro/view.php', $paramurl);
}

Expand Down
2 changes: 1 addition & 1 deletion classes/event/submission_viewed.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function get_url() {
$paramurl['id'] = $this->contextinstanceid;
$paramurl['submissionid'] = $this->objectid;
$paramurl['mode'] = $this->other['mode'];
$paramurl['section'] = 'submissionform';
$paramurl['section'] = 'responsesubmit';
return new \moodle_url('/mod/surveypro/view.php', $paramurl);
}

Expand Down
7 changes: 4 additions & 3 deletions classes/formbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ public function set_user_boundary_formpages() {
FROM {surveypro_item}
WHERE surveyproid = :surveyproid
AND reserved = :reserved
AND hidden = :hidden
AND plugin <> :plugin';
$whereparams = ['surveyproid' => $this->surveypro->id, 'reserved' => 0, 'plugin' => 'pagebreak'];
$whereparams = ['surveyproid' => $this->surveypro->id, 'reserved' => 0, 'hidden' => 0, 'plugin' => 'pagebreak'];
$boundaries = $DB->get_record_sql($sql, $whereparams);

$userfirstpage = isset($boundaries->userfirstpage) ? $boundaries->userfirstpage : 1;
Expand Down Expand Up @@ -232,7 +233,7 @@ private function page_has_items($formpage) {
}

foreach ($itemseeds as $itemseed) {
$parentitem = surveypro_get_item($this->cm, $this->surveypro, $itemseed->parentid);
$parentitem = surveypro_get_itemclass($this->cm, $this->surveypro, $itemseed->parentid);
if ($parentitem->userform_is_child_allowed_static($this->get_submissionid(), $itemseed)) {
// If at least one parent allows its child, I finished. The page is going to display items.
return true;
Expand Down Expand Up @@ -296,7 +297,7 @@ public function get_prefill_data() {
[$where, $params] = surveypro_fetch_items_seeds($id, true, $canaccessreserveditems, null, SURVEYPRO_TYPEFIELD, $page);
if ($itemseeds = $DB->get_recordset_select('surveypro_item', $where, $params, 'sortindex', 'id, type, plugin')) {
foreach ($itemseeds as $itemseed) {
$item = surveypro_get_item($this->cm, $this->surveypro, $itemseed->id, $itemseed->type, $itemseed->plugin);
$item = surveypro_get_itemclass($this->cm, $this->surveypro, $itemseed->id, $itemseed->type, $itemseed->plugin);

$where = ['submissionid' => $this->submissionid, 'itemid' => $item->get_itemid()];
$olduserdata = $DB->get_record('surveypro_answer', $where);
Expand Down
Loading

0 comments on commit 96968f8

Please sign in to comment.