File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 44
44
$ PAGE ->set_heading ($ title );
45
45
$ PAGE ->navbar ->add ($ title , new moodle_url ('/admin/tool/paymentplugin/course_settings.php ' ));
46
46
47
- // Display Page.
48
- echo $ OUTPUT ->header ();
49
-
50
47
// Course Settings Form.
51
48
$ args = array ('course ' => $ course , 'id ' => $ courseid );
52
49
$ paymentform = new course_settings (new moodle_url ('/admin/tool/paymentplugin/course_settings.php ' ,
56
53
$ tablename = 'tool_paymentplugin_course ' ;
57
54
$ cost = $ formdata ->coursecost ;
58
55
59
- if ( $ DB ->record_exists ($ tablename , ['courseid ' => $ courseid ])) {
60
- $ record = $ DB -> get_record ( $ tablename , [ ' courseid ' => $ courseid ]);
56
+ $ record = $ DB ->get_record ($ tablename , ['courseid ' => $ courseid ]);
57
+ if ( $ record ) {
61
58
$ record ->cost = $ cost ;
62
59
$ DB ->update_record ($ tablename , $ record );
63
60
} else {
64
- $ record = ( object ) array ('courseid ' => $ courseid , 'cost ' => $ cost );
61
+ $ record = array ('courseid ' => $ courseid , 'cost ' => $ cost );
65
62
$ DB ->insert_record ($ tablename , $ record );
66
63
}
67
64
}
65
+
66
+ // Display Page.
67
+ echo $ OUTPUT ->header ();
68
+
68
69
$ paymentform ->display ();
69
70
70
71
echo $ OUTPUT ->footer ();
You can’t perform that action at this time.
0 commit comments