Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 38... Línea 38...
38
        $questionnames = '';
38
        $questionnames = '';
39
        $inuse = false;
39
        $inuse = false;
40
        $questionversions = [];
40
        $questionversions = [];
41
        $countselectedquestion = count($questionids);
41
        $countselectedquestion = count($questionids);
Línea 42... Línea 42...
42
 
42
 
43
        if ($deleteallversions) {
43
        $versionsofeachquestionbankentry = $deleteallversions
-
 
44
            ? \question_bank::get_all_versions_of_questions($questionids)
-
 
45
            : \question_bank::get_version_of_questions($questionids);
44
            $versionsofeachquestionbankentry = \question_bank::get_all_versions_of_questions($questionids);
46
 
45
            foreach ($versionsofeachquestionbankentry as $entryid => $versions) {
47
        foreach ($versionsofeachquestionbankentry as $entryid => $versions) {
46
                // Re-order to oldest first.
48
            // Re-order to the oldest first.
47
                $versionsofeachquestionbankentry[$entryid] = array_reverse($versions, true);
49
            $versionsofeachquestionbankentry[$entryid] = array_reverse($versions, true);
48
                // Flip the array to list question by question id. [ qid => version ].
50
            // Flip the array to list question by question id. [ qid => version ].
49
                $questionversions += array_flip($versions);
-
 
50
            }
-
 
51
            // Flatten an array.
-
 
52
            $questionids = array_merge(...$versionsofeachquestionbankentry);
51
            $questionversions += array_flip($versions);
-
 
52
        }
-
 
53
        // Flatten an array.
Línea 53... Línea 54...
53
        }
54
        $questionids = array_merge(...$versionsofeachquestionbankentry);
54
 
55
 
Línea 55... Línea 56...
55
        // Get the names of all the questions.
56
        // Get the names of all the questions.
Línea 60... Línea 61...
60
            if (questions_in_use([$questionid])) {
61
            if (questions_in_use([$questionid])) {
61
                $questionnames .= '* ';
62
                $questionnames .= '* ';
62
                $inuse = true;
63
                $inuse = true;
63
            }
64
            }
64
            $questionname = format_string($questions[$questionid]->name);
65
            $questionname = format_string($questions[$questionid]->name);
65
            if (isset($questionversions[$questionid])) {
-
 
-
 
66
 
66
                $a = new \stdClass();
67
            $a = new \stdClass();
67
                $a->name = $questionname;
68
            $a->name = $questionname;
68
                $a->version = $questionversions[$questionid];
69
            $a->version = $questionversions[$questionid];
69
                $questionnames .= get_string('questionnameandquestionversion',
70
            $questionnames .= get_string('questionnameandquestionversion', 'question', $a) . '<br />';
70
                    'question', $a) . '<br />';
-
 
71
            } else {
-
 
72
                $questionnames .= $questionname . '<br />';
-
 
73
            }
-
 
74
        }
71
        }
Línea 75... Línea 72...
75
 
72
 
76
        // Add the in-use message if required.
73
        // Add the in-use message if required.
77
        if ($inuse) {
74
        if ($inuse) {