| Conditions | 3 |
| Paths | 2 |
| Total Lines | 51 |
| Code Lines | 35 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 42 | function show_admins($user, $teamid) { |
||
| 43 | page_head(tra("Add or remove Team Admins")); |
||
| 44 | echo tra("You can select team members as 'Team Admins'. Team Admins can:")." |
||
| 45 | <ul> |
||
| 46 | <li>".tra("Edit team information (name, URL, description, country)")." |
||
| 47 | <li>".tra("View the team's join/quit history")." |
||
| 48 | <li>".tra("Send messages to the team")." |
||
| 49 | <li>".tra("Moderate the team forum, if any (admins get email notification of moderation events and red X reports)")." |
||
| 50 | </ul> |
||
| 51 | ".tra("Team Admins cannot:")." |
||
| 52 | <ul> |
||
| 53 | <li>".tra("Change the team founder")." |
||
| 54 | <li>".tra("Remove members")." |
||
| 55 | <li>".tra("Add or remove Team Admins")." |
||
| 56 | </ul> |
||
| 57 | ".tra("If a Team Admin quits the team, they cease to be a Team Admin.")." |
||
| 58 | <br /><br />".tra("We recommend that you select only people you know and trust very well as Team Admins.") |
||
| 59 | ; |
||
|
|
|||
| 60 | $admins = BoincTeamAdmin::enum("teamid=$teamid"); |
||
| 61 | start_table(); |
||
| 62 | if (count($admins)==0) { |
||
| 63 | row1(tra("There are currently no Team Admins")); |
||
| 64 | } else { |
||
| 65 | row1(tra("Current Team Admins"), 3); |
||
| 66 | table_header(tra("Name"), tra("Became Team Admin on"), ""); |
||
| 67 | foreach ($admins as $admin) { |
||
| 68 | show_admin($user, $admin); |
||
| 69 | } |
||
| 70 | } |
||
| 71 | end_table(); |
||
| 72 | |||
| 73 | echo " |
||
| 74 | <p> |
||
| 75 | <form action=team_admins.php> |
||
| 76 | <input type=hidden name=action value=add> |
||
| 77 | <input type=hidden name=teamid value=$teamid> |
||
| 78 | "; |
||
| 79 | echo form_tokens($user->authenticator); |
||
| 80 | start_table(); |
||
| 81 | row1(tra("Add Team Admin")); |
||
| 82 | row2(tra("Email address of team member:"), '<input class="form-control" name="email_addr">'); |
||
| 83 | row2("", |
||
| 84 | sprintf('<input class="btn" %s type=submit action value="%s">', |
||
| 85 | button_style(), |
||
| 86 | tra("Add") |
||
| 87 | ) |
||
| 88 | ); |
||
| 89 | end_table(); |
||
| 90 | echo "</form>"; |
||
| 91 | |||
| 92 | page_tail(); |
||
| 93 | } |
||
| 139 |