Ejemplo n.º 1
0
 /**
  *
  * Отыскивает по ключевому запросу пользователя
  *
  * @param string $query
  */
 public function search($query)
 {
     $results = array();
     try {
         $items = UsersDBManager::searchByLogin($query);
         foreach ($items as $row) {
             $results[] = array('id' => $row['id'], 'login' => $row['login'], 'email' => $row['email']);
         }
     } catch (Exception $e) {
         $results[] = array('id' => 0, 'login' => 'nothing ', 'email' => 'found');
     }
     print json_encode($results);
     die;
 }
Ejemplo n.º 2
0
 protected function searchUsers()
 {
     try {
         ACLUser::checkCurrentUserGrants([\UserAccount::PermissionName]);
         $items = \UsersDBManager::searchByLogin($this->searchPhrase);
     } catch (\Exception $e) {
         $items = [];
     }
     foreach ($items as $row) {
         $route = CMS::getInstance()->getDispatcher()->getNamed('dashboard.users.manage');
         $add = new SearchResultModel();
         $add->title = $row['login'];
         $add->icon = 'glyphicon glyphicon-user';
         $add->link = $route->buildUrl() . '?id=' . $row['id'];
         $this->results[] = $add;
     }
 }