{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":18366462,"defaultBranch":"master","name":"moodle-mod_surveypro","ownerLogin":"kordan","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2014-04-02T13:00:05.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/554353?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1712863952.0","currentOid":""},"activityList":{"items":[{"before":"c770953e4ab843c80634f5c05a50c4e245439a56","after":"318fce52f70491f953c54e9bad20ef5e59e02664","ref":"refs/heads/php8.2","pushedAt":"2024-06-12T08:12:31.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"d135bf055944cffaaccce8b75a908160c7717da4","after":"c770953e4ab843c80634f5c05a50c4e245439a56","ref":"refs/heads/php8.2","pushedAt":"2024-06-11T12:50:14.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"0dca9e44b861a725980b0c99f1e05a47fc1952d3","after":"d135bf055944cffaaccce8b75a908160c7717da4","ref":"refs/heads/php8.2","pushedAt":"2024-06-11T12:27:58.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"b56e703756947ca2f6f456b4adf1cc8c81b04ebe","after":"0dca9e44b861a725980b0c99f1e05a47fc1952d3","ref":"refs/heads/php8.2","pushedAt":"2024-06-11T11:01:53.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"7d503e5630cfbedb3b872a2d1ff2cf8919b50583","after":"b56e703756947ca2f6f456b4adf1cc8c81b04ebe","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T12:12:12.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"a94b0a7882788720b5b500f684fd016c4447dff7","after":"7d503e5630cfbedb3b872a2d1ff2cf8919b50583","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T08:31:49.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"0f1b572a2a8d8d8cf4946b7ed2bcf719af78f3de","after":"a94b0a7882788720b5b500f684fd016c4447dff7","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T08:28:21.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"634e34186540ce1347ff1f657583aff4c326e9b2","after":"0f1b572a2a8d8d8cf4946b7ed2bcf719af78f3de","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T08:06:21.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"b2bcb1b19e457c80bdf2a5ebd485dc7be1ed05bd","after":"634e34186540ce1347ff1f657583aff4c326e9b2","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T06:53:56.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"50c78b3f1fd1c9506d77ebd3537601c6e4cec138","after":"b2bcb1b19e457c80bdf2a5ebd485dc7be1ed05bd","ref":"refs/heads/php8.2","pushedAt":"2024-05-18T03:15:13.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"ce439105f0bdc8f87b14f15702355aa21840ea71","after":"50c78b3f1fd1c9506d77ebd3537601c6e4cec138","ref":"refs/heads/php8.2","pushedAt":"2024-05-17T11:03:42.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"d3a5fbc4402a7f57b030ef82cdb9d42c8f92d77a","after":"ce439105f0bdc8f87b14f15702355aa21840ea71","ref":"refs/heads/php8.2","pushedAt":"2024-05-17T08:34:27.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"d217004922835586b88739c014dfc60a6f38e9f9","after":"d3a5fbc4402a7f57b030ef82cdb9d42c8f92d77a","ref":"refs/heads/php8.2","pushedAt":"2024-05-01T16:07:14.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"12fc91eb744c889a8c34bfa08e0fe6a3f11de8cf","after":"d217004922835586b88739c014dfc60a6f38e9f9","ref":"refs/heads/php8.2","pushedAt":"2024-05-01T07:53:52.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"262b003227b7de86ae8b32c5022381f529d8db5a","after":"12fc91eb744c889a8c34bfa08e0fe6a3f11de8cf","ref":"refs/heads/php8.2","pushedAt":"2024-05-01T03:51:36.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"4aaecb5b974e26fd9651b8c795a6699581ce4fce","after":"262b003227b7de86ae8b32c5022381f529d8db5a","ref":"refs/heads/php8.2","pushedAt":"2024-04-30T19:13:53.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"612113b7775d1301eda1038f0147c2a515f24083","after":"4aaecb5b974e26fd9651b8c795a6699581ce4fce","ref":"refs/heads/php8.2","pushedAt":"2024-04-30T17:49:43.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"a5c4d02c3f776ff1699355d9e267833f57cb1112","after":"612113b7775d1301eda1038f0147c2a515f24083","ref":"refs/heads/php8.2","pushedAt":"2024-04-26T15:12:18.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"29813f6822e338763992714c458867d9a72ccdd0","after":"a5c4d02c3f776ff1699355d9e267833f57cb1112","ref":"refs/heads/php8.2","pushedAt":"2024-04-26T13:05:21.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"16dd92242c41241ddb85710d4a641cd1a69ecce7","after":"29813f6822e338763992714c458867d9a72ccdd0","ref":"refs/heads/php8.2","pushedAt":"2024-04-25T19:02:55.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"fe42e8b8ed73f3fff37c003a97585f1c490ccbe1","after":"16dd92242c41241ddb85710d4a641cd1a69ecce7","ref":"refs/heads/php8.2","pushedAt":"2024-04-25T14:26:53.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"4cdab915ae4a93bc6ed4fb688445ba966ea4c362","after":"693d762dc956d1af13b6d0601ffb3868c9f43817","ref":"refs/heads/master","pushedAt":"2024-04-25T08:51:16.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"Update README.md","shortMessageHtmlLink":"Update README.md"}},{"before":"01c16ef703a3775d96543ab0066e44a1696ecb65","after":"fe42e8b8ed73f3fff37c003a97585f1c490ccbe1","ref":"refs/heads/php8.2","pushedAt":"2024-04-24T12:26:24.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"cea978764424cd5144ab6f4799a82e996a63756f","after":"01c16ef703a3775d96543ab0066e44a1696ecb65","ref":"refs/heads/php8.2","pushedAt":"2024-04-24T10:27:37.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"827a8fcf2d8d2ba13d5a5f391bc66eaefa2441d5","after":"cea978764424cd5144ab6f4799a82e996a63756f","ref":"refs/heads/php8.2","pushedAt":"2024-04-22T15:30:19.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"d904fdcdb027f11d81d109032237713c53cc1860","after":"827a8fcf2d8d2ba13d5a5f391bc66eaefa2441d5","ref":"refs/heads/php8.2","pushedAt":"2024-04-22T06:04:47.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"fdc81a5d304327fa74536eafce9c46f2656f36a5","after":"d904fdcdb027f11d81d109032237713c53cc1860","ref":"refs/heads/php8.2","pushedAt":"2024-04-21T12:37:33.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"6fde831bf5b7d440dc34abe5170c2955eea0760e","after":"fdc81a5d304327fa74536eafce9c46f2656f36a5","ref":"refs/heads/php8.2","pushedAt":"2024-04-21T08:51:36.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"809e83ccd80bd5fa78bd7de721728c667f494a7b","after":"6fde831bf5b7d440dc34abe5170c2955eea0760e","ref":"refs/heads/php8.2","pushedAt":"2024-04-21T03:55:17.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}},{"before":"9db8ccd8bfcaa9a49ec47e7ab696ae83eb351fe6","after":"809e83ccd80bd5fa78bd7de721728c667f494a7b","ref":"refs/heads/php8.2","pushedAt":"2024-04-21T03:39:43.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"kordan","name":"Kordan","path":"/kordan","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/554353?s=80&v=4"},"commit":{"message":"This PR contains the content of three major improvements achieved in the last two months.\n\nThose three improvements can be described as follows:\n\n1. translation of the content and content_format fields from the item plugin specific tables (surveypro(field|format)_itemplugin) to the parent table (surveypro_item).\n This first result is described in the content_among_basics branch (https://github.com/kordan/moodle-mod_surveypro/tree/content_among_basics).\n I have never created a pull request for this branch because I have never been able to perform a rebase that satisfied me.\n In practice: the method, named in master \"item_add_mandatory_base_fields\" was renamed in the branch to \"item_add_defaults_for_base_fields\".\n By rebasing content_among_basics on master the rename of the method was discarded so, after the rebase, I still found the original name.\n I spent a few days trying to understand the reason for this behavior. I asked my colleagues and then abandoned the problem.\n\n2. 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).\n 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.\n\n3. 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.\n Obviously this branch was created on top of others_to_base_propertye, consequently, the php8.2 merge makes the first two branches useless.\n\n The outcome of \"content_among_basics\" is described in (1).\n The outcome of \"others_to_base_property\" is described in (2).\n The outcome of \"php8.2\" is described in (3).\n\n=====================================================\n(1) Content and contentformat moved among base fields\n\nAs 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.\nThe 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.\nThere are two reflections related to this problem:\n- 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;\nI 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\".\nThe 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.)\nI 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\".\nSo 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.\n\n The two most difficult fields to move are 'content' and 'contentformat'. This is the reason that led me to this PR.\n\n- I lose compatibility with the past. I will write somewhere that if you want to keep your usertemplates and mastertemplates, you need to:\n -- before upgrading surveypro you have to load each usertemplate and mastertemplate into a course;\n -- upgrade your surveypro;\n -- regenerate each usertemplate and each mastertemplate.\n 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).\n\n=====================================================\n(2) Each common propery is now saved to surveypro_item\n\nWhen \"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.\n\nWith this PR the situation of properties should be:\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\nid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nsurveyproid (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntype (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nplugin (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ncontent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | √ | NO |\ncontentformat | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\n\nrequired | √ | NO | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nindent | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nposition | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\ncustomnumber | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | √ | NO |\nhideinstructions | √ | NO | NO | √ | √ | √ | √ | NO | √ | √ | √ | NO | √ | √ | NO | √ | √ | √ | NO | NO | NO | NO |\n\nvariable | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\nextranote | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | NO | NO | NO | NO |\n\nhidden | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ninsearchform | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nreserved | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nsortindex (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nformpage (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\nparentid | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\nparentvalue | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n\ntimecreated (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\ntimemodified (h) | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ | √ |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n```\nAll the properties in the first column are relative to a field of the table surveypro_item.\nAll the properties in the first column correspond to a field of the item_setupbaseform that is the initial part of each itemsetupform.\nNot all the items use ALL of that properties. They declare the use of each property throught $this->insetupform[] = (false|true);\nIf $this->insetupform[] == false, the corresponding field in the formbase is not displayed in item_setupbaseform (and the useless default goes into the database).\nMarked with (h) are properties hidden to user.\n\nIn the next table the list of specific properties item per item.\nThese properties are save in surveypro(field|format)_.\nYes, 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\nI decided to save these properties among the fields of the child table and not in surveypro_item.\n```\n | AGE | AUTOFILL | BOOLEAN | CHARACTER | CHECKBOX | DATE | DATETIME | FILEUPLOAD | INTEGER | MULTISELECT | NUMERIC | RADIOBUTTON | RATE | RECURRENCE | SELECT | SHORTDATE | TEXTAREA | TIME | FIELDSET | FIELDSETEND | LABEL | PAGEBREAK |\n––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––\n | defaultoption | hiddenfield | defaultoption | trimonsave | options | defaultoption | step | maxfiles | defaultoption | options | defaultvalue | options | options | defaultoption | options | defaultoption | trimonsave | step | defaultstatus | | fullwidth |\n | defaultvalue | element01 | defaultvalue | defaultvalue | labelother | defaultvalue | defaultvalue | maxbytes | defaultvalue | defaultvalue | signed | labelother | rates | defaultvalue | labelother | defaultvalue | useeditor | defaultoption | | leftlabel |\n | lowerbound | element02 | downloadformat | pattern | defaultvalue | downloadformat | defaultvalue | filetypes | lowerbound | noanswerdefault | lowerbound | defaultoption | defaultoption | downloadformat | defaultoption | downloadformat | arearows | defaultvalue |\n | upperbound | element03 | style | minlength | noanswerdefault | lowerbound | downloadformat | | upperbound | downloadformat | upperbound | defaultvalue | defaultvalue | lowerbound | defaultvalue | lowerbound | areacols | downloadformat |\n | element04 | | maxlength | downloadformat | upperbound | lowerbound | | minimumrequired | decimals | downloadformat | downloadformat | upperbound | downloadformat | upperbound | minlength | lowerbound |\n | element05 | | minimumrequired | | upperbound | | maximumrequired | | adjustment | style | | maxlength | upperbound |\n | maximumrequired | | heightinrows | | differentrates |\n | adjustment |\n```\n\n=====================================================\n(3) php8.2\nThis improvement makes surveypro compatible with php8.2.\nThere is some small problem, however, that I don't understand and which, for this reason, I describe below.\n\n(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\n\nThe problem that php8.2 raises is practically always linked to the fact that I can not evaluate a property without first declare it.\nOne 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\nfile_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?\n\n(b) Furthermore, but this is a completely secondary detail, protected $content_editor is considered an error by Code Checker.\n```\nFILE: /home/runner/work/moodle-mod_surveypro/moodle-mod_surveypro/moodle/mod/surveypro/classes/itembase.php\n 93 | ERROR | [x] Member variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.MemberNameUnderscore)\n1128 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n1129 | ERROR | [x] Variable \"content_editor\" must not contain underscores.\n | | (moodle.NamingConventions.ValidVariableName.VariableNameUnderscore)\n```\n\n(c) In php8.2 and moodle master, I frequently get the error \"Javascript code and/or AJAX requests are not ready after 10 seconds\".\nAt 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.\n\n(d) I'm having a problem with style sheets.\nMoodle 4.4 defines the style class:\n\n```\n.mb-3, .my-3 {\n margin-bottom: 1rem !important;\n}\n```\n\nTo override this class I am forced to use:\n\n```\n.path-mod-surveypro #userentry .mb-3,\n.path-mod-surveypro #usersearch .mb-3 {\n margin-bottom: 0 !important;\n}\n```\n\nspecifying NECESSARILY !important to be able to override the parent class.\n\nThe \"!important\" specification, however, is classified by Grunt (in the context of the GHA) as an error:\n\n```\nmod/surveypro/styles.css\n 28:22 ✖ Unexpected !important declaration-no-important\n 348:24 ✖ Unexpected !important declaration-no-important\n 356:24 ✖ Unexpected !important declaration-no-important\n 361:24 ✖ Unexpected !important declaration-no-important\n 366:22 ✖ Unexpected !important declaration-no-important\n 374:22 ✖ Unexpected !important declaration-no-important\n 379:22 ✖ Unexpected !important declaration-no-important\n 384:24 ✖ Unexpected !important declaration-no-important\n 392:24 ✖ Unexpected !important declaration-no-important\n 397:24 ✖ Unexpected !important declaration-no-important\n 402:22 ✖ Unexpected !important declaration-no-important\n 409:22 ✖ Unexpected !important declaration-no-important\n 414:22 ✖ Unexpected !important declaration-no-important\n 419:24 ✖ Unexpected !important declaration-no-important\n 426:24 ✖ Unexpected !important declaration-no-important\n 431:24 ✖ Unexpected !important declaration-no-important\n 436:22 ✖ Unexpected !important declaration-no-important\n 443:22 ✖ Unexpected !important declaration-no-important\n 448:22 ✖ Unexpected !important declaration-no-important\n 453:25 ✖ Unexpected !important declaration-no-important\n 460:25 ✖ Unexpected !important declaration-no-important\n 465:25 ✖ Unexpected !important declaration-no-important\n 470:23 ✖ Unexpected !important declaration-no-important\n 477:23 ✖ Unexpected !important declaration-no-important\n 482:23 ✖ Unexpected !important declaration-no-important\n 487:25 ✖ Unexpected !important declaration-no-important\n 494:25 ✖ Unexpected !important declaration-no-important\n 499:25 ✖ Unexpected !important declaration-no-important\n\n28 problems (28 errors, 0 warnings)\n```","shortMessageHtmlLink":"This PR contains the content of three major improvements achieved in …"}}],"hasNextPage":true,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAAEYwrRTQA","startCursor":null,"endCursor":null}},"title":"Activity · kordan/moodle-mod_surveypro"}