Esempio n. 1
0
 /**
  * Method lists users, galleries and images that match provided string.
  */
 public function action()
 {
     if (post('search')) {
         $str = post('search');
         $str = preg_replace("#[^0-9a-z]#i", "", $str);
         //getting search results that match given string
         $users = UserRepository::searchUsers($str);
         $galleries = GalleryRepository::searchGalleries($str);
         $photos = PhotoRepository::searchPhotos($str);
         //showing results
         $searchResults = new SearchResults();
         $searchResults->setUsers($users);
         $searchResults->setGalleries($galleries);
         $searchResults->setPhotos($photos);
         echo $searchResults;
     }
 }
Esempio n. 2
0
    public function searchResult()
    {
        $data = '';
        if (post('search')) {
            $str = post('search');
            $str = preg_replace("#[^0-9a-z]#i", "", $str);
            $users = UserRepository::searchUsers($str);
            foreach ($users as $user) {
                ?>
                    <div>
                        <a href="<?php 
                echo \route\Route::get("twitterWall")->generate(array("id" => $user['userid']));
                ?>
">
                            <?php 
                echo $user['username'];
                ?>
                        </a>
                    </div>
                <?php 
            }
            echo $data;
        }
    }