Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Class: ListFactory

Source Location: /system/classes/listfactory.class.php

Class Overview


Geeklog List Factory Class


Author(s):

  • Sami Barakat, s.m.barakat AT gmail DOT com

Methods



Class Details

[line 131]
Geeklog List Factory Class



Tags:

author:  Sami Barakat, s.m.barakat AT gmail DOT com


[ Top ]


Class Methods


constructor ListFactory [line 159]

ListFactory ListFactory( string $url, [array $limits = '10,15,20,25,30,35'], [int $per_page = 20])

Constructor

Sets up private url variable and defines the LF_SOURCE_TITLE, LF_SOURCE_NAME and LF_ROW_NUMBER constants.




Tags:

access:  public


Parameters:

string   $url   The URL of the page the table appears on
array   $limits   The avaliable page limits
int   $per_page   The default number or rows per page

[ Top ]

method addResult [line 303]

void addResult( array $result)

Appends a single result to the list



Tags:

access:  public


Parameters:

array   $result   A single result that will be appended to the rest

[ Top ]

method addResultArray [line 315]

void addResultArray( $arr, array $result)

Appends several results to the list



Tags:

access:  public


Parameters:

array   $result   An array of result that will be appended to the rest
   $arr  

[ Top ]

method ExecuteQueries [line 447]

array ExecuteQueries( )

Executes pre set queries



Tags:

return:  The results found
access:  public


[ Top ]

method getFormattedOutput [line 580]

string getFormattedOutput( array $rows_arr, string $title, [string $list_top = ''], [string $list_bottom = ''], [boolean $show_sort = true], [boolean $show_limit = true])

Generates the HTML code based on the preset style



Tags:

return:  HTML output
access:  public


Parameters:

array   $rows_arr   The rows to display in the list
string   $title   The title of the list
string   $list_top   HTML that will appear before the list is printed
string   $list_bottom   HTML that will appear after the list is printed
boolean   $show_sort   True to enable column sorting, false to disable
boolean   $show_limit   True to show page limits, false to hide

[ Top ]

method setCallback [line 257]

void setCallback( string $title, string $name, $callback, int $rank, int $total, string $function)

Sets a callback function that provides another source for results.

The function will be passed two parameters, $offset and $limit, which will determine how many results are requested. The callback function should then return a multidimensional array containing the results. This provides an alternative to the setQuery() function as results can be sourced from anywhere.




Tags:

access:  public


Parameters:

string   $title   The text that's displayed to the user
string   $name   The local name given to the query
string   $function   Any callable function, method or lambda
int   $rank   The rating that determins how many results will be returned
int   $total   The total number of results that are avaliable
   $callback  

[ Top ]

method setDefaultSort [line 291]

void setDefaultSort( string $field, [string $direction = 'desc'])

Sets the default sort field



Tags:

access:  public


Parameters:

string   $field   The field name to sort
string   $direction   'asc' for ascending order and 'desc' for descending order

[ Top ]

method setField [line 204]

void setField( string $title, string $name, [boolean $display = true], [boolean $sort = true], [string $format = '%s'])

Sets a field in the list.

Note: LF_ROW_NUMBER cannot be sorted




Tags:

access:  public


Parameters:

string   $title   The title of the field which is displayed to the user
string   $name   The local name given to the field
boolean   $display   True if the field is to be displayed to the user otherwise false
boolean   $sort   True if the field can be sorted otherwise false
string   $format   The format string with one type specifier

[ Top ]

method setQuery [line 228]

void setQuery( string $title, string $name, string $sql, int $rank)

Sets the SQL query that will generate rows



Tags:

access:  public


Parameters:

string   $title   The text that's displayed to the user
string   $name   The local name given to the query
string   $sql   The SQL string without the ORDER BY or LIMIT clauses
int   $rank   The rating that determins how many results will be returned

[ Top ]

method setRowFunction [line 278]

void setRowFunction( $callback, callback $function)

Sets the callback function thats called on every row for styling or formatting.



Tags:

access:  public


Parameters:

callback   $function   Any callable function, method or lambda
   $callback  

[ Top ]

method setStyle [line 186]

void setStyle( string $style)

Determins which set of templates to load when formatting the output



Tags:

access:  public


Parameters:

string   $style   Either 'table' or 'inline'

[ Top ]


Documentation generated on Sat, 11 Feb 2012 02:08:35 -0500 by phpDocumentor 1.4.3