Code Duplication    Length = 10-10 lines in 2 locations

assign.php 2 locations

@@ 60-69 (lines=10) @@
57
58
// Process incoming user assignments to the relationship
59
60
if ($canassign && optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
61
    $userstoassign = $potentialuserselector->get_selected_users();
62
    if (!empty($userstoassign)) {
63
        foreach ($userstoassign as $adduser) {
64
            relationship_add_member($relationshipgroup->id, $adduser->relationshipcohortid, $adduser->userid);
65
        }
66
        $potentialuserselector->invalidate_selected_users();
67
        $existinguserselector->invalidate_selected_users();
68
    }
69
}
70
71
// Process removing user assignments to the relationship
72
if ($canassign && optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) {
@@ 72-81 (lines=10) @@
69
}
70
71
// Process removing user assignments to the relationship
72
if ($canassign && optional_param('remove', false, PARAM_BOOL) && confirm_sesskey()) {
73
    $userstoremove = $existinguserselector->get_selected_users();
74
    if (!empty($userstoremove)) {
75
        foreach ($userstoremove as $removeuser) {
76
            relationship_remove_member($relationshipgroup->id, $removeuser->relationshipcohortid, $removeuser->userid);
77
        }
78
        $potentialuserselector->invalidate_selected_users();
79
        $existinguserselector->invalidate_selected_users();
80
    }
81
}
82
83
// Print the form.
84
if ($editable) {