samples/12_table_and_pagination_helpers/page_test_3_controller.php

Show: PublicProtectedPrivateinherited
Table of Contents
Sample controller 3 for the pagination helper
Package
Tina-MVC  
Subpackage
Samples  

\page_test_3_controller

Package: Tina-MVC\Samples
Yet another sample paginator

Illustrates the use of the tina_mvc_pagination_helper_class

This shows how to supress sortable columns. In cases where your SQL statement is complex the Pagination Helper will munge your SQL code and cause errors when you click on a heading

Parent(s)
\TINA_MVC\tina_mvc_controller_class

Properties

>VPropertypublicarray $capability_to_view
inherited

overrides the defaults from app_settings.php

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$capability_to_view
>VPropertyprotectedstring $raw_request
inherited

'tina_page/controller/method/data1/data2'

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$raw_request
Details
Type
string
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$raw_request  
>VPropertyprotectedarray $request
inherited

the Tina MVC request array( 'tina_page', 'controller', 'method', 'data1', 'data2', ... )

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$request
Details
Type
array
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$request  
>VPropertypublicarray $role_to_view
inherited

overrides the defaults from app_settings.php

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$role_to_view
Details
Type
array
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$role_to_view  
>VPropertypublicstring $shortcode_content = ''
inherited

if called from a non self-closing shortcode, the content

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$shortcode_content
Default value''Details
Type
string
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$shortcode_content  
See
\TINA_MVC\tina_mvc_shortcode_func()  
>VPropertyprotectedobject $template_vars
inherited

View data for passing to a template. Contains 2 objects, one for escaped data and one for non escaped data

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$template_vars
Details
Type
object
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$template_vars  
See
\TINA_MVC\$this->add_var()  
See
\TINA_MVC\$this->add_var_e()  
>VPropertyprotectedstring $the_post_content
inherited

the controllers output

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$the_post_content
>VPropertyprotectedstring $the_post_title
inherited

the controllers output

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$the_post_title
>VPropertyprotectedarray $tina_mvc_page
inherited

the Tina MVC page

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$tina_mvc_page
>VPropertypublicboolean $use_dispatcher = TRUE
inherited

whether to use the dispatcher method after creating an instance of the derived class.

Inherited from: \TINA_MVC\tina_mvc_controller_class::$$use_dispatcher
Default valueTRUEDetails
Type
boolean
Inherited_from
\TINA_MVC\tina_mvc_controller_class::$$use_dispatcher  
See
\TINA_MVC\$this->dispatcher()  

Methods

methodpublic__construct(array $request = array(), string $called_from = 'PAGE_FILTER') : void
inherited

Sets the Tina MVC request.

Inherited from: \TINA_MVC\tina_mvc_controller_class::__construct()

If you are using the dispatcher functionality then you do not need to call this constructor from yoru child classes. The Tina MVC request is set by the base controller before calling the dispatch() function.

Parameters
NameTypeDescription
$requestarray

the Tina MVC request

$called_fromstring

'PAGE_FILTER', 'WIDGET', 'SHORTCODE' or 'CALL_CONTROLLLER_FUNC'

methodpublicadd_var(string $key = NULL, mixed $v = NULL, boolean $esc = FALSE) : boolean
inherited

Add a variable to $this->template_vars

Inherited from: \TINA_MVC\tina_mvc_controller_class::add_var()

Allows you to drop your template variables into an object for retrieval by $this->load_vew()

The key is added as a property of (object) $this->template_vars

Parameters
NameTypeDescription
$keystring

the object property name to use when adding data

$vmixed

variable to add

$escboolean

whether to escape data or not

Returns
TypeDescription
boolean
Details
See
\TINA_MVC\$this->template_vars  
See
\TINA_MVC\$this->add_var_e()  
See
\TINA_MVC\$this->load_view()  
methodpublicadd_var_e(string $key = NULL, mixed $v = NULL) : boolean
inherited

Add an escaped variable to $this->view_data

Inherited from: \TINA_MVC\tina_mvc_controller_class::add_var_e()

Any variables added using this will be escaped. Allows you to drop your template variables into an object for retrieval by $this->load_vew()

Parameters
NameTypeDescription
$keystring

the object property name to use when adding data

$vmixed

variable to add

Returns
TypeDescription
boolean
Details
See
\TINA_MVC\$this->view_Data  
See
\TINA_MVC\$this->add_var()  
See
\TINA_MVC\$this->load_view()  
methodpublicdispatch() : void
inherited

Calls controller functions based on the Tina MVC request (page/controller/function/data1/data2/.

Inherited from: \TINA_MVC\tina_mvc_controller_class::dispatch()

..)

If there is no function call in the Tina MVC request, $this->index() is called. Otherwise looks for a class method based on the function part of the request. This allows you to name your class methods according to your actions. e.g. page/controller/my-action will be mapped on to $this->my_action(). Default action is always $this->index()

The dispatcher is used by default.

Make any methods that you do not want called by the dispatcher method 'private' for security and name them with a leading underscore to prevent the dispatcher from trying to load them. E.g. '_my_method'

methodpublicget_post_content() : string
inherited

Gets the Wordpress Tina MVC page content

Inherited from: \TINA_MVC\tina_mvc_controller_class::get_post_content()

Used by tina_mvc_controller_class

Returns
TypeDescription
string
methodpublicget_post_title() : string
inherited

Gets the Wordpress Tina MVC page title

Inherited from: \TINA_MVC\tina_mvc_controller_class::get_post_title()

Used by tina_mvc_controller_class

Returns
TypeDescription
string
methodprivateinclude_model(string $f, string $m) : mixed
inherited

Includes a model

Inherited from: \TINA_MVC\tina_mvc_controller_class::include_model()

The same search order is used as for controllers

Parameters
NameTypeDescription
$fstring

the full path and filname

$mstring

the model name

Returns
TypeDescription
mixedthe model object or FALSE
methodpublicindex() : void

The default function

Set up some variables and add them to the view file data

methodpublicload_model(string $model = '', string $custom_folder = FALSE) : object
inherited

Locates a Tina MVC model file and return an instance of the model class

Inherited from: \TINA_MVC\tina_mvc_controller_class::load_model()

Looks for a file in the same order as for controllers and view files. Model files are named {$model}_model.php and define a class called {$model}

Parameters
NameTypeDescription
$modelstring

the name of the model file (without '_model.php')

$custom_folderstring

path to load the model from

Returns
TypeDescription
objectan instance of the model class
methodpublicload_view(string $view = false, mixed $V = NULL, string $custom_folder = FALSE) : string
inherited

Includes/Parses a HTML file and return as a string

Inherited from: \TINA_MVC\tina_mvc_controller_class::load_view()

Looks for a file in the same folder as the controller named {$view}_view.php and includes it. Any variables passed in $V are extracted into the global scope of the HTML view file. This allows the use of

and

template constructs.

In fact we can use any

 .. do something .. 

just like in normal PHP mixed HTML/PHP templating. {$view}_view.php is intended to be a HTML file

If $view is FALSE and $V is string, the string data is used as the parsed view file. i.e. without requiring a view file.

Alternatively you can assign template data to $this->template_vars using $this->add_var() and $this->add_var_e(). If data is in $this->template_vars it will be used in preference to data passed to this function.

You should use

if( !defined('TINA_MVC_LOAD_VIEW') ) die;

or something similar to avoid users being able to call the template directly.

Parameters
NameTypeDescription
$viewstring

the name of the view file (without '_view.php')

$Vmixed

variable (usually array or object) passed to the included file for parsing by the template

$custom_folderstring

an overriding location to load the view from (relative to the Tina MVC plugin folder)

Returns
TypeDescription
stringthe parsed view file (usually HTML)
Details
See
\TINA_MVC\$this->view_data  
methodpublicmail(mixed $to = FALSE, mixed $cc = FALSE, mixed $bcc = FALSE, string $subject, string $message_template = FALSE, array $message_variables = array()) : boolean
inherited

Grabs an email message template and merges it with any variables you pass.

Inherited from: \TINA_MVC\tina_mvc_controller_class::mail()

Use this for any emails you want to send through Tina MVC. Templates are like normal Tina MVC view files except they are named *_email.php.

The templates are stored in the user or Tina MVC 'pages', 'shortcodes' and 'widgets' folders (just like controllers, views and models).

Variables are extract() ed into the local scope of the message template. $to, $cc, $bcc and $subject will also be added to that scope. Beware: this will overwrite variables of the same name passed through $message_variables.

Parameters
NameTypeDescription
$tomixed

The recipients address (array or string)

$ccmixed
$bccmixed
$subjectstring
$message_templatestring

Template to use (without the '_email.php')

$message_variablesarray

Data to be merged into the message (usually array or object )

Returns
TypeDescription
boolean
methodprivateparse_view_file(string $f, mixed $V, boolean $add_html_comments = TRUE) : mixed
inherited

Includes and parses a view file or an email file

Inherited from: \TINA_MVC\tina_mvc_controller_class::parse_view_file()
Parameters
NameTypeDescription
$fstring

full path and filename to file

$Vmixed

the view data

$add_html_commentsboolean

Add HTML comments at the start and end of the view file

Returns
TypeDescription
mixedFALSE or the parsed view file
methodpublicset_called_from(string $c = 'PAGE_FILTER') : void
Parameters
NameTypeDescription
$cstring
methodpublicset_post_content(string $str) : void
inherited

Sets the Tina MVC page content from your application

Inherited from: \TINA_MVC\tina_mvc_controller_class::set_post_content()
Parameters
NameTypeDescription
$strstring
methodpublicset_post_title(string $str) : void
inherited

Sets the Tina MVC page title from your application

Inherited from: \TINA_MVC\tina_mvc_controller_class::set_post_title()
Parameters
NameTypeDescription
$strstring
methodpublicset_request(string $request = array(), string $raw_request = '') : void
inherited

Sets the Tina MVC raw_request (handy to have if you need the original uri)

Inherited from: \TINA_MVC\tina_mvc_controller_class::set_request()
Parameters
NameTypeDescription
$requeststring
$raw_requeststring
Documentation was generated by phpDocumentor 2.0.0a12.