1414// You should have received a copy of the GNU General Public License
1515// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616
17+ namespace mod_questionnaire ;
18+
1719use mod_questionnaire \feedback \section ;
20+ use stdClass ;
21+ use context_module ;
22+ use html_writer ;
1823
1924defined ('MOODLE_INTERNAL ' ) || die ();
2025
21- require_once ($ CFG ->dirroot . '/mod/questionnaire/locallib.php ' );
26+ require_once ($ CFG ->dirroot . '/mod/questionnaire/locallib.php ' );
2227
2328#[\AllowDynamicProperties]
2429/**
@@ -225,14 +230,14 @@ public function build_response_from_appdata(stdClass $appdata, $sec=0) {
225230 $ questions [$ questionid ] = $ this ->questions [$ questionid ];
226231 }
227232 }
228- return mod_questionnaire \ responsetype \response \response::response_from_appdata ($ this ->id , 0 , $ appdata , $ questions );
233+ return responsetype \response \response::response_from_appdata ($ this ->id , 0 , $ appdata , $ questions );
229234 }
230235
231236 /**
232237 * Add the renderer to the questionnaire object.
233238 * @param plugin_renderer_base $renderer The module renderer, extended from core renderer.
234239 */
235- public function add_renderer (plugin_renderer_base $ renderer ) {
240+ public function add_renderer (\ plugin_renderer_base $ renderer ) {
236241 $ this ->renderer = $ renderer ;
237242 }
238243
@@ -297,7 +302,7 @@ public function view() {
297302 $ this ->update_grades ($ quser );
298303
299304 // Update completion state.
300- $ completion = new completion_info ($ this ->course );
305+ $ completion = new \ completion_info ($ this ->course );
301306 if ($ completion ->is_enabled ($ this ->cm ) && $ this ->completionsubmit ) {
302307 $ completion ->update_state ($ this ->cm , COMPLETION_COMPLETE );
303308 }
@@ -1431,7 +1436,7 @@ private function print_survey_start($message, $section, $numsections, $hasrequir
14311436 // Disable the pdf function for now, until it looks a lot better.
14321437 if (false ) {
14331438 $ linkname = get_string ('downloadpdf ' , 'mod_questionnaire ' );
1434- $ link = new moodle_url ('/mod/questionnaire/report.php ' ,
1439+ $ link = new \ moodle_url ('/mod/questionnaire/report.php ' ,
14351440 [
14361441 'action ' => 'vresp ' ,
14371442 'instance ' => $ this ->id ,
@@ -1440,18 +1445,18 @@ private function print_survey_start($message, $section, $numsections, $hasrequir
14401445 'rid ' => $ rid
14411446 ]
14421447 );
1443- $ downpdficon = new pix_icon ('b/pdfdown ' , $ linkname , 'mod_questionnaire ' );
1448+ $ downpdficon = new \ pix_icon ('b/pdfdown ' , $ linkname , 'mod_questionnaire ' );
14441449 $ respinfo .= $ this ->renderer ->action_link ($ link , null , null , null , $ downpdficon );
14451450 }
14461451
14471452 $ linkname = get_string ('print ' , 'mod_questionnaire ' );
14481453 $ link = new \moodle_url ('/mod/questionnaire/report.php ' ,
14491454 ['action ' => 'vresp ' , 'instance ' => $ this ->id , 'target ' => 'print ' , 'individualresponse ' => 1 , 'rid ' => $ rid ]);
1450- $ htmlicon = new pix_icon ('t/print ' , $ linkname );
1455+ $ htmlicon = new \ pix_icon ('t/print ' , $ linkname );
14511456 $ options = ['menubar ' => true , 'location ' => false , 'scrollbars ' => true , 'resizable ' => true ,
14521457 'height ' => 600 , 'width ' => 800 , 'title ' => $ linkname ];
14531458 $ name = 'popup ' ;
1454- $ action = new popup_action ('click ' , $ link , $ name , $ options );
1459+ $ action = new \ popup_action ('click ' , $ link , $ name , $ options );
14551460 $ respinfo .= $ this ->renderer ->action_link ($ link , null , $ action , ['title ' => $ linkname ], $ htmlicon ) . ' ' ;
14561461 }
14571462 $ respinfo .= get_string ('respondent ' , 'questionnaire ' ).': <strong> ' .$ ruser .'</strong> ' ;
@@ -1482,12 +1487,12 @@ private function print_survey_start($message, $section, $numsections, $hasrequir
14821487 $ options = array ('menubar ' => true , 'location ' => false , 'scrollbars ' => true , 'resizable ' => true ,
14831488 'height ' => 600 , 'width ' => 800 , 'title ' => $ title );
14841489 $ name = 'popup ' ;
1485- $ link = new moodle_url ($ url );
1486- $ action = new popup_action ('click ' , $ link , $ name , $ options );
1490+ $ link = new \ moodle_url ($ url );
1491+ $ action = new \ popup_action ('click ' , $ link , $ name , $ options );
14871492 $ class = "floatprinticon " ;
14881493 $ this ->page ->add_to_page ('printblank ' ,
14891494 $ this ->renderer ->action_link ($ link , $ linkname , $ action , array ('class ' => $ class , 'title ' => $ title ),
1490- new pix_icon ('t/print ' , $ title )));
1495+ new \ pix_icon ('t/print ' , $ title )));
14911496 }
14921497 if ($ section == 1 ) {
14931498 if (!empty ($ this ->survey ->title )) {
@@ -2536,11 +2541,11 @@ private function response_goto_thankyou() {
25362541 $ currentgroupid = 0 ;
25372542 }
25382543 if ($ this ->capabilities ->readownresponses ) {
2539- $ url = new moodle_url ('myreport.php ' , ['id ' => $ this ->cm ->id , 'instance ' => $ this ->cm ->instance , 'user ' => $ USER ->id ,
2544+ $ url = new \ moodle_url ('myreport.php ' , ['id ' => $ this ->cm ->id , 'instance ' => $ this ->cm ->instance , 'user ' => $ USER ->id ,
25402545 'byresponse ' => 0 , 'action ' => 'vresp ' ]);
25412546 $ this ->page ->add_to_page ('continue ' , $ this ->renderer ->single_button ($ url , get_string ('continue ' )));
25422547 } else {
2543- $ url = new moodle_url ('/course/view.php ' , ['id ' => $ this ->course ->id ]);
2548+ $ url = new \ moodle_url ('/course/view.php ' , ['id ' => $ this ->course ->id ]);
25442549 $ this ->page ->add_to_page ('continue ' , $ this ->renderer ->single_button ($ url , get_string ('continue ' )));
25452550 }
25462551 return ;
@@ -2684,10 +2689,10 @@ public function survey_results_navbar_alpha($currrid, $currentgroupid, $cm, $byr
26842689 $ options = array ('menubar ' => true , 'location ' => false , 'scrollbars ' => true ,
26852690 'resizable ' => true , 'height ' => 600 , 'width ' => 800 );
26862691 $ name = 'popup ' ;
2687- $ link = new moodle_url ($ url );
2688- $ action = new popup_action ('click ' , $ link , $ name , $ options );
2692+ $ link = new \ moodle_url ($ url );
2693+ $ action = new \ popup_action ('click ' , $ link , $ name , $ options );
26892694 $ actionlink = $ this ->renderer ->action_link ($ link , $ linkname , $ action , ['title ' => $ title ],
2690- new pix_icon ('t/print ' , $ title ));
2695+ new \ pix_icon ('t/print ' , $ title ));
26912696 $ navbar ->printaction = $ actionlink ;
26922697 $ this ->page ->add_to_page ('navigationbar ' , $ this ->renderer ->navigationbar ($ navbar ));
26932698
@@ -3350,7 +3355,7 @@ public function generate_csv($currentgroupid, $rid='', $userid='', $choicecodes=
33503355 if (in_array ($ type , $ choicetypes )) {
33513356 /* single or multiple or rate */
33523357 if (!isset ($ choicesbyqid [$ qid ])) {
3353- throw new coding_exception ('Choice question has no choices! ' , 'question id ' .$ qid .' of type ' .$ type );
3358+ throw new \ coding_exception ('Choice question has no choices! ' , 'question id ' .$ qid .' of type ' .$ type );
33543359 }
33553360 $ choices = $ choicesbyqid [$ qid ];
33563361
@@ -3768,7 +3773,7 @@ public function response_analysis($rid, $resps, $compare, $isgroupmember, $allre
37683773 }
37693774 }
37703775 if ($ this ->survey ->feedbackscores ) {
3771- $ table = new html_table ();
3776+ $ table = new \ html_table ();
37723777 $ table ->size = [null , null ];
37733778 $ table ->align = ['left ' , 'right ' , 'right ' ];
37743779 $ table ->head = [];
@@ -3906,7 +3911,7 @@ public function response_analysis($rid, $resps, $compare, $isgroupmember, $allre
39063911 $ oppositeallscore = ' | ' .$ allscore [1 ].'% ' ;
39073912 }
39083913 if ($ this ->survey ->feedbackscores ) {
3909- $ table = $ table ?? new html_table ();
3914+ $ table = $ table ?? new \ html_table ();
39103915 if ($ compare ) {
39113916 $ table ->data [] = array ($ sectionlabel , $ score [0 ].'% ' .$ oppositescore , $ allscore [0 ].'% ' .$ oppositeallscore );
39123917 } else {
@@ -4050,11 +4055,11 @@ public function response_analysis($rid, $resps, $compare, $isgroupmember, $allre
40504055 }
40514056 // If all questions of $section are unseen then don't show feedbackscores for this section.
40524057 if ($ compare && !is_nan ($ scorepercent [$ key ])) {
4053- $ table = $ table ?? new html_table ();
4058+ $ table = $ table ?? new \ html_table ();
40544059 $ table ->data [] = array ($ sectionlabel , $ scorepercent [$ key ] . '% ' . $ oppositescore ,
40554060 $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
40564061 } else if (isset ($ allscorepercent [$ key ]) && !is_nan ($ allscorepercent [$ key ])) {
4057- $ table = $ table ?? new html_table ();
4062+ $ table = $ table ?? new \ html_table ();
40584063 $ table ->data [] = array ($ sectionlabel , $ allscorepercent [$ key ] . '% ' . $ oppositeallscore );
40594064 }
40604065 }
0 commit comments