searchRoster

(/rs/public/functions.php)

searchRoster -- Finds member id's based on search string.

Description

array searchRoster ($string)

This function returns an array of member id's that match a search string. The values in the array are returned in order of precedence. The lowest or first key (obtained using reset() )is the best match as determined by the function.

$string is checked in the following order:


  1. If $string is empty, return an empty array.

  2. If $string is an integer, assume it is a pin. Return the pin without further checking.

  3. Check $string against executive abbreviations. If a match is found, return right away without further checking

  4. The Name field in Roster is searched. If multiple matches, order by descending rank.

  5. IRC Nicks are then checked. If multiple matches, order by descending rank.

  6. Email addresses are then checked. If multiple matches, order by descending rank.

  7. Callsigns are then checked. If multiple matches, order by descending rank.

  8. Redirects are then checked. No order is given to them.

  9. AIM Screennames are then checked. If multiple matches, order by descending rank.


  10. Before the 4th step, the result array is returned as soon as a match is found. Once step 4 happens, it checks all the remaining steps until the end before returning the result.

    This function returns an emtpy array on failure.

    Examples

    searchRoster () /* Returns an empty array */

    searchRoster (1) /* Returns an array containing value 1 (if pin 1 exists, otherwise return empty array) */

    searchRoster ("foo") /* Checks against execs, then against everything else listed above. If an exec match is found, return it. Otherwise, return all other matches. */

    Related Functions

    None.

    Dependencies

    None.

    Function Index