public function search($query, &$results = array()) {

        if (!empty($query)):
            $words = explode(' ', $query);
            foreach ($words as $word) {
                $_results =
                    $this->setListLookUpConditions("user_first_name", $word, 'OR')
                        ->setListLookUpConditions("user_last_name", $word, 'OR')
                        ->setListLookUpConditions("user_middle_name", $word, 'OR')
                        ->setListLookUpConditions("user_name_id", $word, 'OR');
            }

            $_results = $this->getObjectsList("user");
            $rows = $_results->fetchAll();

            //Include the members section
            $members = array(
                "filterid" => "users",
                "title" => "People",
                "results" => array()
            );
            //Loop through fetched attachments;
            //@TODO might be a better way of doing this, but just trying
            foreach ($rows as $member) {
                $photo = empty($member['user_photo']) ? "" : "/system/object/{$member['user_photo']}/resize/170/170";
                $members["results"][] = array(
                    "icon" => $photo, //optional
                    "link" => "/member:{$member['user_name_id']}/profile/timeline",
                    "title" => $this->getFullName($member['user_first_name'], $member['user_middle_name'], $member['user_last_name']), //required
                    "description" => "", //required
                    "type" => $member['object_type'],
                    "user_name_id" => $member['user_name_id']
                );
            }

            //Add the members section to the result array, only if they have items;
            if (!empty($members["results"]))
                $results[] = $members;

        endif;

        return true;
    }
public function search($query, &$results = array()) {

        if (!empty($query)):
            $words = explode(' ', $query);
            foreach ($words as $word) {
                $_results =
                    $this->setListLookUpConditions("user_first_name", $word, 'OR')
                        ->setListLookUpConditions("user_last_name", $word, 'OR')
                        ->setListLookUpConditions("user_middle_name", $word, 'OR')
                        ->setListLookUpConditions("user_name_id", $word, 'OR');
            }

            $_results = $this->getObjectsList("user");
            $rows = $_results->fetchAll();

            //Include the members section
            $members = array(
                "filterid" => "users",
                "title" => "People",
                "results" => array()
            );
            //Loop through fetched attachments;
            //@TODO might be a better way of doing this, but just trying
            foreach ($rows as $member) {
                $photo = empty($member['user_photo']) ? "" : "/system/object/{$member['user_photo']}/resize/170/170";
                $members["results"][] = array(
                    "icon" => $photo, //optional
                    "link" => "/member:{$member['user_name_id']}/profile/timeline",
                    "title" => $this->getFullName($member['user_first_name'], $member['user_middle_name'], $member['user_last_name']), //required
                    "description" => "", //required
                    "type" => $member['object_type'],
                    "user_name_id" => $member['user_name_id']
                );
            }

            //Add the members section to the result array, only if they have items;
            if (!empty($members["results"]))
                $results[] = $members;

        endif;

        return true;
    }
public function search ( $ query , & $ results = array ( ) ) { if ( ! empty ( $ query ) ) : $ words = explode ( ' ' , $ query ) ; foreach ( $ words as $ word ) { $ _results = $ this -> setListLookUpConditions ( "user_first_name" , $ word , 'OR' ) -> setListLookUpConditions ( "user_last_name" , $ word , 'OR' ) -> setListLookUpConditions ( "user_middle_name" , $ word , 'OR' ) -> setListLookUpConditions ( "user_name_id" , $ word , 'OR' ) ; } $ _results = $ this -> getObjectsList ( "user" ) ; $ rows = $ _results -> fetchAll ( ) ; //Include the members section $ members = array ( "filterid" => "users" , "title" => "People" , "results" => array ( ) ) ; //Loop through fetched attachments; //@TODO might be a better way of doing this, but just trying foreach ( $ rows as $ member ) { $ photo = empty ( $ member [ 'user_photo' ] ) ? "" : "/system/object/{$member['user_photo']}/resize/170/170" ; $ members [ "results" ] [ ] = array ( "icon" => $ photo , //optional "link" => "/member:{$member['user_name_id']}/profile/timeline" , "title" => $ this -> getFullName ( $ member [ 'user_first_name' ] , $ member [ 'user_middle_name' ] , $ member [ 'user_last_name' ] ) , //required "description" => "" , //required "type" => $ member [ 'object_type' ] , "user_name_id" => $ member [ 'user_name_id' ] ) ; } //Add the members section to the result array, only if they have items; if ( ! empty ( $ members [ "results" ] ) ) $ results [ ] = $ members ; endif ; return true ; }
Searches the database for users

@param type $query
@param type $results
Searches the database for users