| Conditions | 3 |
| Paths | 3 |
| Total Lines | 53 |
| Code Lines | 36 |
| 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 |
||
| 27 | function show_admin_page($user, $team) { |
||
| 28 | page_head(tra("Team administration for %1", $team->name)); |
||
| 29 | echo " |
||
| 30 | <ul> |
||
| 31 | <li><a href=team_edit_form.php?teamid=$team->id>".tra("Edit team info")."</a> |
||
| 32 | <br><small>".tra("Change team name, URL, description, type, or country")."</small> |
||
| 33 | <li><a href=pm.php?action=new&teamid=$team->id>".tra("Send message to team")."</a> |
||
| 34 | <li> |
||
| 35 | ".tra("Member list:")." |
||
| 36 | <a href=team_email_list.php?teamid=$team->id>".tra("HTML")."</a> |
||
| 37 | · <a href=team_email_list.php?teamid=$team->id&plain=1>".tra("text")."</a> |
||
| 38 | · <a href=team_email_list.php?teamid=$team->id&xml=1>".tra("XML")."</a> |
||
| 39 | <br><small>".tra("View member info")."</small> |
||
| 40 | <li>".tra("View change history:")." |
||
| 41 | <a href=team_delta.php?teamid=$team->id>".tra("HTML")."</a> |
||
| 42 | · <a href=team_delta.php?teamid=$team->id&xml=1>".tra("XML")."</a> |
||
| 43 | <br><small>".tra("See when members joined or quit this team")."</small> |
||
| 44 | "; |
||
| 45 | |||
| 46 | // founder-only stuff follows |
||
| 47 | // |
||
| 48 | if ($team->userid == $user->id) { |
||
| 49 | $tokens = url_tokens($user->authenticator); |
||
| 50 | if ($team->ping_user > 0) { |
||
| 51 | $user2 = BoincUser::lookup_id($team->ping_user); |
||
| 52 | $deadline = date_str(transfer_ok_time($team)); |
||
| 53 | echo "<li> |
||
| 54 | <a href=team_change_founder_form.php?teamid=$team->id><font color=red><strong>".tra("Respond to foundership request.")."</strong></font></a> ".tra("If you don't respond by %1, %2 may assume foundership of this team.", $deadline, $user2->name) |
||
| 55 | ; |
||
|
|
|||
| 56 | } |
||
| 57 | echo " |
||
| 58 | <li><a href=team_remove_inactive_form.php?teamid=$team->id>".tra("Remove members")."</a> |
||
| 59 | <br><small>".tra("Remove inactive or unwanted members from this team")."</small> |
||
| 60 | <li><a href=team_change_founder_form.php?teamid=$team->id>".tra("Change founder")."</a> |
||
| 61 | <br><small>".tra("Transfer foundership to another member")."</small> |
||
| 62 | <li><a href=team_admins.php?teamid=$team->id>".tra("Add/remove Team Admins")."</a> |
||
| 63 | <br><small>".tra("Give selected team members Team Admin privileges")."</small> |
||
| 64 | |||
| 65 | <li><a href=team_manage.php?teamid=$team->id&action=delete&$tokens>".tra("Remove team")."</a> |
||
| 66 | <br><small>".tra("Allowed only if team has no members")."</small> |
||
| 67 | <li><a href=team_forum.php?teamid=$team->id&cmd=manage>".tra("Message board")."</a> |
||
| 68 | <br><small>".tra("Create or manage a team message board")."</small> |
||
| 69 | "; |
||
| 70 | } |
||
| 71 | echo " |
||
| 72 | <li> |
||
| 73 | ".tra("To have this team created on all BOINC projects (current and future) you can make it into a %1 BOINC-wide team %2.", "<a href=https://boinc.berkeley.edu/teams/>", "</a>")." |
||
| 74 | <li> |
||
| 75 | ".tra("Team admins are encouraged to join and participate in the Google %1 boinc-team-founders %2 group.", "<a href=https://groups.google.com/forum/#!forum/boinc-team-founders>", "</a>")." |
||
| 76 | </ul> |
||
| 77 | "; |
||
| 78 | |||
| 79 | page_tail(); |
||
| 80 | } |
||
| 102 |