Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-40612

Code tidy up and improvement for alternate name fields.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide
      1. Run complete unit tests
      2. Check the following areas for errors / warnings.
      • Groups overview : Create some groups and check the users in each group.
      • Mod forum : Create a forum and a discussion and make some posts with different users.
      • quiz : make a quiz and make sure that you make some questions. Take the quiz with a few students. Check the following areas:
        • quiz report - attempts report
        • quiz report - basic report
        • question bank
      • SCORM : Create a scorm activity and do the activity with a few students. Check the following areas:
        • scorm interactions report
        • scorm objectives report
      Show
      Run complete unit tests Check the following areas for errors / warnings. Groups overview : Create some groups and check the users in each group. Mod forum : Create a forum and a discussion and make some posts with different users. quiz : make a quiz and make sure that you make some questions. Take the quiz with a few students. Check the following areas: quiz report - attempts report quiz report - basic report question bank SCORM : Create a scorm activity and do the activity with a few students. Check the following areas: scorm interactions report scorm objectives report
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-40612-master-one

      Description

      As per Marina's suggestions:

      1. Add a 3rd parameter to the function get_all_user_name_fields() which specifies a prefix for the retrieved sql fields.
      2. adding a new function that does a reverse mapping, i.e. to substitute repeating pieces of code like

                    $allnames = get_all_user_name_fields();
                    foreach ($allnames as $allname) {
                        $tempname = 'creator' . $allname;
                        if (isset($question->$tempname)) {
                            $u->$allname = $question->$tempname;
                        }
                    }
        

        or the same without prefix

                    $allnames = get_all_user_name_fields();
                    foreach ($allnames as $addname) {
                        $userinfo[$reviewer->reviewerid]->$addname = $reviewer->$addname;
                    } 
        

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  18/Nov/13