1717/**
1818 * Privacy Implementation for lsf_unification.
1919 *
20- * @package lsf_unification
20+ * @package local_lsf_unification
2121 * @copyright 2018 Nina Herrmann
2222 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323 */
@@ -46,7 +46,7 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l
4646 * @param $collection
4747 * @return mixed
4848 */
49- public static function _get_metadata ($ collection ) {
49+ public static function _get_metadata ($ collection ) {
5050 $ collection ->add_database_table (
5151 'local_lsf_course ' ,
5252 [
@@ -55,7 +55,7 @@ public static function _get_metadata ($collection) {
5555 'timestamp ' => 'privacy:metadata:local_lsf_unification:timestamp ' ,
5656 'requeststate ' => 'privacy:metadata:local_lsf_unification:requeststate ' ,
5757 'requesterid ' => 'privacy:metadata:local_lsf_unification:requesterid ' ,
58- 'acceptorid ' => 'privacy:metadata:local_lsf_unification:acceptorid '
58+ 'acceptorid ' => 'privacy:metadata:local_lsf_unification:acceptorid ' ,
5959
6060 ],
6161 'privacy:metadata:local_lsf_unification '
@@ -69,7 +69,7 @@ public static function _get_metadata ($collection) {
6969 * @return contextlist $contextlist The list of contexts for a specific user.
7070 * @throws \dml_exception
7171 */
72- public static function _get_contexts_for_userid ($ userid ) {
72+ public static function _get_contexts_for_userid ($ userid ) {
7373 global $ DB ;
7474 $ contextlist = new contextlist ();
7575
@@ -133,7 +133,7 @@ public static function _export_user_data(approved_contextlist $contextlist) {
133133 }
134134 }
135135 $ subcontext = [
136- get_string ('pluginname ' , 'local_lsf_unification ' )
136+ get_string ('pluginname ' , 'local_lsf_unification ' ),
137137 ];
138138 if (!empty ($ contextdatatowrite )) {
139139 writer::with_context ($ context )->export_data ($ subcontext , (object )$ contextdatatowrite );
@@ -154,14 +154,14 @@ private function create_data_to_write($action, $courserequest, $username) {
154154 global $ DB ;
155155 $ status = '' ;
156156 switch ($ courserequest ->requeststate ) {
157- case 0 :
157+ case 0 :
158158 $ status = "is declined or not requested " ;
159159 break ;
160- case 1 :
160+ case 1 :
161161 $ status =
162162 "is waiting " ;
163163 break ;
164- case 2 :
164+ case 2 :
165165 $ status =
166166 "is granted " ;
167167 break ;
@@ -170,10 +170,10 @@ private function create_data_to_write($action, $courserequest, $username) {
170170 'action ' => get_string ('privacy:local_lsf_unification: ' . $ action , 'local_lsf_unification ' ),
171171 'timestamp ' => date ('c ' , $ courserequest ->timestamp ),
172172 'username ' => $ username ,
173- 'status ' => $ status
173+ 'status ' => $ status,
174174 ];
175175 // In case the course exist we add the name to the information.
176- $ course = $ DB ->get_record ('course ' , array ( 'id ' => $ courserequest ->mdlid ) );
176+ $ course = $ DB ->get_record ('course ' , [ 'id ' => $ courserequest ->mdlid ] );
177177 if (!empty ($ course )) {
178178 $ data ->coursename = $ course ->fullname ;
179179 }
@@ -194,10 +194,10 @@ public static function _delete_data_for_all_users_in_context($context) {
194194 return ;
195195 }
196196 // Sanity check that context is at the User context level.
197- if ($ context ->contextlevel == CONTEXT_USER ) {
197+ if ($ context ->contextlevel == CONTEXT_USER ) {
198198 $ userid = $ context ->instanceid ;
199- $ DB ->delete_records ("local_lsf_course " , array ( 'acceptorid ' => $ userid) );
200- $ DB ->delete_records ("local_lsf_course " , array ( 'requesterid ' => $ userid) );
199+ $ DB ->delete_records ("local_lsf_course " , [ 'acceptorid ' => $ userid] );
200+ $ DB ->delete_records ("local_lsf_course " , [ 'requesterid ' => $ userid] );
201201 }
202202 }
203203
@@ -214,15 +214,14 @@ public static function _delete_data_for_user($contextlist) {
214214 }
215215
216216 foreach ($ contexts as $ context ) {
217-
218217 // Sanity check that context is at the User context level, then get the userid.
219218 if ($ context ->contextlevel !== CONTEXT_USER ) {
220219 continue ;
221220 }
222221
223222 $ userid = $ context ->instanceid ;
224- $ DB ->delete_records ("local_lsf_course " , array ( 'acceptorid ' => $ userid) );
225- $ DB ->delete_records ("local_lsf_course " , array ( 'requesterid ' => $ userid) );
223+ $ DB ->delete_records ("local_lsf_course " , [ 'acceptorid ' => $ userid] );
224+ $ DB ->delete_records ("local_lsf_course " , [ 'requesterid ' => $ userid] );
226225 }
227226 }
228- }
227+ }
0 commit comments