Пример #1
0
 function set_params(&$params)
 {
     parent::set_params($params);
     $db = Application::getDb();
     $user = Application::getEntityInstance('user');
     $table = $user->getTableName();
     $keyword = trim($this->getValue('search_keyword'));
     if ($keyword) {
         $skeyword = addslashes($keyword);
         $params['where'][] = "({$table}.name LIKE '%{$keyword}%' OR {$table}.email LIKE '%{$keyword}%' OR {$table}.login LIKE '%{$keyword}%')";
     }
     $role_id = $this->getValue('search_role_id');
     if ($role_id) {
         foreach ($role_id as &$r) {
             $r = (int) $r;
         }
         $coupling_table = $user->getRolesCouplingTableName();
         $role_id = implode(',', $role_id);
         $params['from'][] = "\r\n            \t\tINNER JOIN {$coupling_table} ON {$coupling_table}.user_id={$table}.id AND {$coupling_table}.role_id IN({$role_id})\r\n            \t";
         $params['group_by'][] = "{$table}.id";
     }
 }