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 130]
Geeklog List Factory Class



Tags:

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


[ Top ]


Class Methods


constructor __construct [line 156]

ListFactory __construct( 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 291]

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 302]

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 420]

array ExecuteQueries( )

Executes pre set queries



Tags:

return:  The results found
access:  public


[ Top ]

method getFormattedOutput [line 548]

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 getFormattedOutput2 [line 777]

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

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
array   $params_arr   GET params array

[ Top ]

method setCallback [line 248]

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 280]

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 198]

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 221]

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 268]

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 182]

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 Sun, 02 Oct 2016 07:51:49 +0000 by phpDocumentor 1.4.3