Skip to content

Latest commit

 

History

History
870 lines (434 loc) · 18.7 KB

class.ControllerCore.md

File metadata and controls

870 lines (434 loc) · 18.7 KB

Class ControllerCore

Contents

Properties

Methods

Properties

$ajax

public boolean $ajax = false

$content_only

protected boolean $content_only = false

$context

protected \Context $context

$controller_type

public string $controller_type

$css_files

public array $css_files = array()

$display_footer

protected string $display_footer

$display_header

protected boolean $display_header

$display_header_javascript

protected boolean $display_header_javascript

$js_files

public array $js_files = array()

$json

protected boolean $json = false

$php_errors

public array $php_errors = array()

$php_self

public string $php_self

$redirect_after

protected string $redirect_after = null

$status

protected string $status = ''

$template

protected string $template

Methods

__construct

mixed ControllerCore::__construct()

addCSS

true ControllerCore::addCSS(string|array $css_uri, string $css_media_type, integer|null $offset, boolean $check_path)

Adds a new stylesheet(s) to the page header.

Arguments

  • $css_uri string|array - Path to CSS file, or list of css files like this : array(array(uri => media_type), ...)
  • $css_media_type string
  • $offset integer|null
  • $check_path boolean

addJS

void ControllerCore::addJS(string|array $js_uri, boolean $check_path)

Adds a new JavaScript file(s) to the page header.

Arguments

  • $js_uri string|array - Path to JS file or an array like: array(uri, ...)
  • $check_path boolean

addJquery

mixed ControllerCore::addJquery(string|null $version, string|null $folder, boolean $minifier)

Adds jQuery library file to queued JS file list

Arguments

  • $version string|null - jQuery library version
  • $folder string|null - jQuery file folder
  • $minifier boolean - If set tot true, a minified version will be included.

addJqueryPlugin

mixed ControllerCore::addJqueryPlugin(string|array $name, $folder, boolean $css)

Adds jQuery plugin(s) to queued JS file list

Arguments

  • $name string|array
  • $folder mixed
  • $css boolean

addJqueryUI

mixed ControllerCore::addJqueryUI(string|array $component, string $theme, boolean $check_dependencies)

Adds jQuery UI component(s) to queued JS file list

Arguments

  • $component string|array
  • $theme string
  • $check_dependencies boolean

ajaxDie

mixed ControllerCore::ajaxDie(string|null $value, string|null $controller, string|null $method)

Dies and echoes output value

Arguments

  • $value string|null
  • $controller string|null
  • $method string|null

checkAccess

mixed ControllerCore::checkAccess()

Check if the controller is available for the current user/visitor

display

mixed ControllerCore::display()

Displays page view

displayFooter

mixed ControllerCore::displayFooter(boolean $display)

Sets page header display

Arguments

  • $display boolean

displayHeader

mixed ControllerCore::displayHeader(boolean $display)

Sets page header display

Arguments

  • $display boolean

displayHeaderJavaScript

mixed ControllerCore::displayHeaderJavaScript(boolean $display)

Sets page header javascript display

Arguments

  • $display boolean

getController

\Controller ControllerCore::getController(string $class_name, boolean $auth, boolean $ssl)

returns a new instance of this controller

Arguments

  • $class_name string
  • $auth boolean
  • $ssl boolean

init

mixed ControllerCore::init()

Initialize the page

initContent

mixed ControllerCore::initContent()

Assigns Smarty variables for the page main content

initCursedPage

mixed ControllerCore::initCursedPage()

Assigns Smarty variables when access is forbidden

initFooter

mixed ControllerCore::initFooter()

Assigns Smarty variables for the page footer

initHeader

mixed ControllerCore::initHeader()

Assigns Smarty variables for the page header

isCached

boolean ControllerCore::isCached(string $template, string|null $cache_id, string|null $compile_id)

Checks if a template is cached

Arguments

  • $template string
  • $cache_id string|null - Cache item ID
  • $compile_id string|null

isXmlHttpRequest

boolean ControllerCore::isXmlHttpRequest()

Checks if the controller has been called from XmlHttpRequest (AJAX)

myErrorHandler

boolean ControllerCore::myErrorHandler(string $errno, string $errstr, string $errfile, integer $errline)

Custom error handler

Arguments

  • $errno string
  • $errstr string
  • $errfile string
  • $errline integer

postProcess

mixed ControllerCore::postProcess()

Do the page treatment: process input, process AJAX, etc.

redirect

mixed ControllerCore::redirect()

Redirects to $this->redirect_after after the process if there is no error

removeCSS

mixed ControllerCore::removeCSS(string|array $css_uri, string $css_media_type, boolean $check_path)

Removes CSS stylesheet(s) from the queued stylesheet list

Arguments

  • $css_uri string|array - Path to CSS file or an array like: array(array(uri => media_type), ...)
  • $css_media_type string
  • $check_path boolean

removeJS

mixed ControllerCore::removeJS(string|array $js_uri, boolean $check_path)

Removes JS file(s) from the queued JS file list

Arguments

  • $js_uri string|array - Path to JS file or an array like: array(uri, ...)
  • $check_path boolean

run

mixed ControllerCore::run()

Starts the controller process (this method should not be overridden!)

setMedia

mixed ControllerCore::setMedia()

Sets default media list for this controller

setRedirectAfter

mixed ControllerCore::setRedirectAfter($url)

Set $this->redirect_after that will be used by redirect() after the process

Arguments

  • $url mixed

setTemplate

mixed ControllerCore::setTemplate(string $template)

Sets template file for page content output

Arguments

  • $template string

smartyOutputContent

mixed ControllerCore::smartyOutputContent(array|string $content)

Renders controller templates and generates page content

Arguments

  • $content array|string - Template file(s) to be rendered

viewAccess

mixed ControllerCore::viewAccess()

Check if the current user/visitor has valid view permissions