@@ -83,10 +83,16 @@ public function output_form() {
8383 */
8484 protected function extra_tabs () {
8585 return [
86- new \core \output \tabobject ('members ' , new \core \url ($ this ->get_index_url (), ['action ' => 'members ' ]),
87- get_string ('members ' , 'local_profilecohort ' )),
88- new \core \output \tabobject ('cohorts ' , new \core \url ('/local/profilecohort/cohorts.php ' ),
89- get_string ('selectcohorts ' , 'local_profilecohort ' )),
86+ new \core \output \tabobject (
87+ 'members ' ,
88+ new \core \url ($ this ->get_index_url (), ['action ' => 'members ' ]),
89+ get_string ('members ' , 'local_profilecohort ' )
90+ ),
91+ new \core \output \tabobject (
92+ 'cohorts ' ,
93+ new \core \url ('/local/profilecohort/cohorts.php ' ),
94+ get_string ('selectcohorts ' , 'local_profilecohort ' )
95+ ),
9096 ];
9197 }
9298
@@ -101,9 +107,12 @@ protected function output_members() {
101107 $ tabs = $ this ->get_tabs ();
102108 $ out .= $ OUTPUT ->render ($ tabs );
103109
104- $ out .= html_writer::tag ('div ' , get_string ('membersintro ' , 'local_profilecohort ' ).'<br/> ' .
110+ $ out .= html_writer::tag (
111+ 'div ' ,
112+ get_string ('membersintro ' , 'local_profilecohort ' ) . '<br/> ' .
105113 get_string ('invisiblecohortsnote ' , 'local_profilecohort ' ),
106- ['id ' => 'intro ' , 'class ' => 'box generalbox ' ]);
114+ ['id ' => 'intro ' , 'class ' => 'box generalbox ' ]
115+ );
107116
108117 $ namefields = \core_user \fields::get_name_fields ();
109118 $ namefields = preg_filter ('/^/ ' , 'u. ' , $ namefields );
@@ -159,16 +168,23 @@ private function output_members_entry($cohortname, $cohortmembers, $lastcohortid
159168 $ id = 'profilecohort-cohortlist- ' . $ lastcohortid ;
160169
161170 // Bootstrap collapse header.
162- $ out .= html_writer::start_tag ('h2 ' , ['class ' => 'accordion-header ' , 'id ' => $ id. '-heading ' ]);
171+ $ out .= html_writer::start_tag ('h2 ' , ['class ' => 'accordion-header ' , 'id ' => $ id . '-heading ' ]);
163172 $ out .= html_writer::start_tag ('button ' , ['class ' => 'accordion-button collapsed ' , 'type ' => 'button ' ,
164- 'data-bs-toggle ' => 'collapse ' , 'data-bs-target ' => '# ' .$ id , 'aria-expanded ' => 'false ' , 'aria-controls ' => $ id , ]);
173+ 'data-bs-toggle ' => 'collapse ' , 'data-bs-target ' => '# ' . $ id , 'aria-expanded ' => 'false ' ,
174+ 'aria-controls ' => $ id , ]);
165175 $ out .= format_string ($ cohortname );
166176 if ($ cohortmembers ) {
167- $ out .= html_writer::tag ('span ' , get_string ('countusers ' , 'local_profilecohort ' , count ($ cohortmembers )),
168- ['class ' => 'badge bg-primary text-light ms-2 ' ]);
177+ $ out .= html_writer::tag (
178+ 'span ' ,
179+ get_string ('countusers ' , 'local_profilecohort ' , count ($ cohortmembers )),
180+ ['class ' => 'badge bg-primary text-light ms-2 ' ]
181+ );
169182 } else {
170- $ out .= html_writer::tag ('span ' , get_string ('countnousers ' , 'local_profilecohort ' ),
171- ['class ' => 'badge bg-secondary text-dark ms-2 ' ]);
183+ $ out .= html_writer::tag (
184+ 'span ' ,
185+ get_string ('countnousers ' , 'local_profilecohort ' ),
186+ ['class ' => 'badge bg-secondary text-dark ms-2 ' ]
187+ );
172188 }
173189 $ out .= html_writer::end_tag ('button ' );
174190 $ out .= html_writer::end_tag ('h2 ' );
@@ -187,7 +203,7 @@ private function output_members_entry($cohortname, $cohortmembers, $lastcohortid
187203 $ content = get_string ('nousers ' , 'local_profilecohort ' );
188204 }
189205
190- $ out .= html_writer::start_div ('accordion-collapse collapse ' , ['id ' => $ id , 'aria-labelledby ' => $ id. '-heading ' ,
206+ $ out .= html_writer::start_div ('accordion-collapse collapse ' , ['id ' => $ id , 'aria-labelledby ' => $ id . '-heading ' ,
191207 'data-bs-parent ' => '#profilecohort-cohortlist ' , ]);
192208 $ out .= html_writer::div ($ content , 'accordion-body ' );
193209 $ out .= html_writer::end_div ();
@@ -202,7 +218,7 @@ private function output_members_entry($cohortname, $cohortmembers, $lastcohortid
202218 */
203219 public static function set_cohorts_from_profile (?\core \event \base $ event = null , $ userid = null ) {
204220 global $ USER , $ DB , $ CFG ;
205- require_once ($ CFG ->dirroot . '/cohort/lib.php ' );
221+ require_once ($ CFG ->dirroot . '/cohort/lib.php ' );
206222
207223 if ($ event ) {
208224 $ userid = $ event ->userid ;
@@ -216,7 +232,7 @@ public static function set_cohorts_from_profile(?\core\event\base $event = null,
216232 return ; // No cohorts handled by this plugin => nothing to do.
217233 }
218234
219- list ( $ csql , $ params) = $ DB ->get_in_or_equal ($ allowedcohortids , SQL_PARAMS_NAMED );
235+ [ $ csql , $ params] = $ DB ->get_in_or_equal ($ allowedcohortids , SQL_PARAMS_NAMED );
220236 $ params ['userid ' ] = $ userid ;
221237 $ select = "userid = :userid AND cohortid $ csql " ;
222238 $ oldcohortids = $ DB ->get_fieldset_select ('cohort_members ' , 'cohortid ' , $ select , $ params );
@@ -301,7 +317,7 @@ protected function apply_all_rules() {
301317 */
302318 public function update_all_cohorts_from_rules () {
303319 global $ DB , $ CFG ;
304- require_once ($ CFG ->dirroot . '/cohort/lib.php ' );
320+ require_once ($ CFG ->dirroot . '/cohort/lib.php ' );
305321
306322 // Create a recordset to load the relevant user profile fields for all users.
307323 $ fieldids = [];
@@ -316,7 +332,7 @@ public function update_all_cohorts_from_rules() {
316332 $ fieldsql [] = "(SELECT data FROM {user_info_data} WHERE fieldid = {$ fieldid } AND userid = u.id) AS field_ {$ fieldid }" ;
317333 }
318334 if ($ fieldsql ) {
319- $ fieldsql = implode (', ' , $ fieldsql ). ', ' ;
335+ $ fieldsql = implode (', ' , $ fieldsql ) . ', ' ;
320336 } else {
321337 $ fieldsql = '' ;
322338 }
0 commit comments