src/snac/server/database/SQL.php
/**
     * Search Users
     *
     * Search the users in the appuser table of the database.  Returns only the userid and
     * full name of the query.  Searches the string in the full name, user name, and email
     * columns.
     *
     * @param string $query The string to search through the user tables
     * @param int $count optional The number of results to return (default null)
     * @param string $roleFilter optional Role name by which to filter the results (default null)
     * @param boolean $everyone optional Whether to include inactive users (default false)
     *
     * @return string[][] Returns a list of lists of search results.
     */
Search Users
Search the users in the appuser table of the database.  Returns only the userid and
full name of the query.  Searches the string in the full name, user name, and email
columns.

@param string $query The string to search through the user tables
@param int $count optional The number of results to return (default null)
@param string $roleFilter optional Role name by which to filter the results (default null)
@param boolean $everyone optional Whether to include inactive users (default false)

@return string[][] Returns a list of lists of search results.
Search Users Search the users in the appuser table of the database . Returns only the userid and full name of the query . Searches the string in the full name user name and email columns . @param string $query The string to search through the user tables @param int $count optional The number of results to return ( default null ) @param string $roleFilter optional Role name by which to filter the results ( default null ) @param boolean $everyone optional Whether to include inactive users ( default false ) @return string [] [] Returns a list of lists of search results .
public function searchUsers($query, $count=null, $roleFilter=null, $everyone=false) {
        $realCount = \snac\Config::$SQL_LIMIT;
        if ($count != null)
            $realCount = $count;
        $activeFilter = "and u.active";
        if ($everyone)
            $activeFilter = "";
        $result = null;
        if ($roleFilter == null) {
            $queryStr = "select u.id, u.fullname from appuser u
                        where u.fullname ilike $1 or u.username ilike $1 or u.email ilike $1
                        $activeFilter
                        order by u.fullname asc limit $2";
            $result = $this->sdb->query($queryStr, array("%$query%", $realCount));
        } else {
            $queryStr = "select u.id, u.fullname from appuser u, appuser_role_link rl, role r
                        where (u.fullname ilike $1 or u.username ilike $1 or u.email ilike $1)
                        and rl.uid = u.id and rl.rid = r.id and r.label = $2
                        $activeFilter
                        order by u.fullname asc limit $3";
            $result = $this->sdb->query($queryStr, array("%$query%", $roleFilter, $realCount));
        }
        $all = array();
        if ($result != null) {
            while($row = $this->sdb->fetchrow($result))
            {
                array_push($all, $row);
            }
        }
        return $all;
    }
public function searchUsers ( $ query , $ count = null , $ roleFilter = null , $ everyone = false ) { $ realCount = \ snac \ Config :: $ SQL_LIMIT ; if ( $ count != null ) $ realCount = $ count ; $ activeFilter = " and u.active " ; if ( $ everyone ) $ activeFilter = " " ; $ result = null ; if ( $ roleFilter == null ) { $ queryStr = " select u.id, u.fullname from appuser u
                        where u.fullname ilike $1 or u.username ilike $1 or u.email ilike $1
                         $ activeFilter 
                        order by u.fullname asc limit $2 " ; $ result = $ this -> sdb -> query ( $ queryStr , array ( " % $ query % " , $ realCount ) ) ; } else { $ queryStr = " select u.id, u.fullname from appuser u, appuser_role_link rl, role r
                        where (u.fullname ilike $1 or u.username ilike $1 or u.email ilike $1)
                        and rl.uid = u.id and rl.rid = r.id and r.label = $2
                         $ activeFilter 
                        order by u.fullname asc limit $3 " ; $ result = $ this -> sdb -> query ( $ queryStr , array ( " % $ query % " , $ roleFilter , $ realCount ) ) ; } $ all = array ( ) ; if ( $ result != null ) { while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { array_push ( $ all , $ row ) ; } } return $ all ; }
Search Users
 Search the users in the appuser table of the database.
Search Users Search the users in the appuser table of the database .