Code Duplication    Length = 7-9 lines in 2 locations

admin/staff.php 2 locations

@@ 279-285 (lines=7) @@
276
                }
277
            }
278
        } elseif($mainRoles = $_xhelpSession->get("xhelp_mainRoles")){    // If roles set on manage staff page
279
            foreach($roles as $role){
280
                if(!in_array($role->getVar('id'), $mainRoles)){
281
                    echo "<tr><td><input type='checkbox' name='roles[]' value='". $role->getVar('id')."' /><a href='staff.php?op=editRole&amp;id=".$role->getVar('id')."&amp;uid=". $uid ."'>". $role->getVar('name') ."</a> - ". $role->getVar('description')."</td></tr>";
282
                } else {
283
                    echo "<tr><td><input type='checkbox' name='roles[]' value='". $role->getVar('id')."' checked='checked' /><a href='staff.php?op=editRole&amp;id=".$role->getVar('id')."&amp;uid=". $uid ."'>". $role->getVar('name') ."</a> - ". $role->getVar('description')."</td></tr>";
284
                }
285
            }
286
        } elseif($lastPage == "editStaff" && (!$storedRoles =& $_xhelpSession->get("xhelp_dept_$deptid"))){
287
            $hStaff =& xhelpGetHandler('staff');
288
            $myRoles =& $hStaff->getRolesByDept($uid, $deptid);
@@ 848-856 (lines=9) @@
845
            echo "<tr><td class='head' width='20%'>". _AM_XHELP_TEXT_ROLES ."</td>
846
                      <td class='even'><table width='75%'>";
847
            if($mainRoles = $_xhelpSession->get("xhelp_mainRoles")){
848
                foreach($roles as $role){
849
                    if(!in_array($role->getVar('id'), $mainRoles)){
850
                        echo "<tr><td><input type='checkbox' name='roles[]' value='". $role->getVar('id')."' onclick=\"xhelpRoleCustOnClick('manageStaff', 'roles[]', 'xhelp_role', '&amp;', 'xhelp_dept_cust');\" />
851
                              <a href='staff.php?op=editRole&amp;id=".$role->getVar('id')."&amp;uid=". $userid ."'>". $role->getVar('name') ."</a> - ". $role->getVar('description')."</td></tr>";
852
                    } else {
853
                        echo "<tr><td><input type='checkbox' name='roles[]' value='". $role->getVar('id')."' checked='checked' onclick=\"xhelpRoleCustOnClick('manageStaff', 'roles[]', 'xhelp_role', '&amp;', 'xhelp_dept_cust');\" />
854
                              <a href='staff.php?op=editRole&amp;id=".$role->getVar('id')."&amp;uid=". $userid ."'>". $role->getVar('name') ."</a> - ". $role->getVar('description')."</td></tr>";
855
                    }
856
                }
857
            } else {
858
                foreach($roles as $role){
859
                    echo "<tr><td><input type='checkbox' name='roles[]' value='". $role->getVar('id')."' onclick=\"xhelpRoleCustOnClick('manageStaff', 'roles[]', 'xhelp_role', '&amp;', 'xhelp_dept_cust');\" />