Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
SQLSearch Class Reference
Inheritance diagram for SQLSearch:
Inheritance graph
Collaboration diagram for SQLSearch:
Collaboration graph

Public Member Functions

 __construct ($query, $title="", $avatarLike="")
 getTitle ()
 getAvatar ($id)
 getAvatarImageTag ($id, $size=Avatar::SMALL)
 getResults ($input, $contextual_data=array(), $limit=PHP_INT_MAX, $offset=0)
 includePath ()
- Public Member Functions inherited from SearchType
 getAvatarImageTag ($id)

Static Public Member Functions

static get ($query, $title="", $avatarLike="")

Protected Attributes

 $sql
 $avatarLike
 $title

Detailed Description

Class of type SearchType used for searches with QuickSearch (lib/classes/QuickSearch.class.php). You can search with a sql-syntax in the database. You just need to give in a query like for a PDB-prepare statement and at least the variable ":input" in the query (the :input will be replaced with the input of the QuickSearch userinput. [code] $search = new SQLSearch("SELECT username, Nachname " "FROM auth_user_md5 " . "WHERE Nachname LIKE :input ", _("Nachname suchen"), "username"); [/code]

Author
Rasmus Fuhse

Constructor & Destructor Documentation

__construct (   $query,
  $title = "",
  $avatarLike = "" 
)
Parameters
string$querySQL with at least ":input" as parameter
string$title
string$avatarLikein this search. array("input_name" => "placeholder_in_sql_query")
Returns
void

Member Function Documentation

static get (   $query,
  $title = "",
  $avatarLike = "" 
)
static

returns an object of type SQLSearch with parameters to constructor

Parameters
string$querySQL with at least ":input" as parameter
string$title
string$avatarLikein this search. array("input_name" => "placeholder_in_sql_query")
Returns
SQLSearch

Here is the caller graph for this function:

getAvatar (   $id)

returns an adress of the avatar of the searched item (if avatar enabled)

Parameters
string$idid of the item which can be username, user_id, Seminar_id or Institut_id
string$sizeenum(NORMAL, SMALL, MEDIUM): size of the avatar-image
Returns
string adress of an image

Reimplemented from SearchType.

Here is the call graph for this function:

Here is the caller graph for this function:

getAvatarImageTag (   $id,
  $size = Avatar::SMALL 
)

returns an html tag of the image of the searched item (if avatar enabled)

Parameters
string$idid of the item which can be username, user_id, Seminar_id or Institut_id
constant$sizeenum(NORMAL, SMALL, MEDIUM): size of the avatar
Returns
string like "<img src="...avatar.jpg" ... >"

Here is the call graph for this function:

getResults (   $input,
  $contextual_data = array(),
  $limit = PHP_INT_MAX,
  $offset = 0 
)

returns the results of a search Use the contextual_data variable to send more variables than just the input to the SQL. QuickSearch for example sends all other variables of the same <form>-tag here.

Parameters
string$inputthe search-word(s)
array$contextual_dataan associative array with more variables
int$limitmaximum number of results (default: all)
int$offsetreturn results starting from this row (default: 0)
Returns
array array(array(), ...)

Reimplemented from SearchType.

Reimplemented in PermissionSearch.

Here is the call graph for this function:

getTitle ( )

returns the title/description of the searchfield

Returns
string title/description

Reimplemented from SearchType.

Reimplemented in StandardSearch.

includePath ( )

A very simple overwrite of the same method from SearchType class. returns the absolute path to this class for autoincluding this class.

Returns
string path to this class

Reimplemented from SearchType.

Reimplemented in PermissionSearch, and StandardSearch.

Field Documentation

$avatarLike
protected
$sql
protected
$title
protected

The documentation for this class was generated from the following file: