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:
- If $string is empty, return an empty array.
- If $string is an integer, assume it is a pin. Return the pin without further checking.
- Check $string against executive abbreviations. If a match is found, return right away without further checking
- The Name field in Roster is searched. If multiple matches, order by descending rank.
- IRC Nicks are then checked. If multiple matches, order by descending rank.
- Email addresses are then checked. If multiple matches, order by descending rank.
- Callsigns are then checked. If multiple matches, order by descending rank.
- Redirects are then checked. No order is given to them.
- AIM Screennames are then checked. If multiple matches, order by descending rank.
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
|