dolibarr 19.0.3
Canvas Class Reference

Class to manage canvas. More...

Public Member Functions

 __construct ($db, $actiontype='view')
 Constructor.
 
 getCanvas ($module, $card, $canvas)
 Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir.
 
 assign_values (&$action='view', $id=0, $ref='')
 Shared method for canvas to assign values for templates.
 
 displayCanvasExists ($action)
 Return if a template exists to display as canvas (if it exists)
 
 display_canvas ($action)
 Display a canvas page.
 
 hasActions ()
 Return if a canvas contains an action controller.
 
 doActions (&$action='view', $id=0)
 Shared method for canvas to execute actions.
 

Private Member Functions

 _cleanaction ($action)
 Return action code cleaned.
 

Detailed Description

Class to manage canvas.

Definition at line 29 of file canvas.class.php.

Constructor & Destructor Documentation

◆ __construct()

Canvas::__construct ( $db,
$actiontype = 'view' )

Constructor.

Parameters
DoliDB$dbDatabase handler
string$actiontypeAction type ('create', 'view', 'edit', 'list')

Definition at line 63 of file canvas.class.php.

References _cleanaction().

Member Function Documentation

◆ _cleanaction()

Canvas::_cleanaction ( $action)
private

Return action code cleaned.

Parameters
string$actionAction type ('create', 'view', 'edit', 'list', 'add', 'update')
Returns
string Cleaned action type ('create', 'view', 'edit', 'list')

Definition at line 76 of file canvas.class.php.

Referenced by __construct(), display_canvas(), and displayCanvasExists().

◆ assign_values()

Canvas::assign_values ( & $action = 'view',
$id = 0,
$ref = '' )

Shared method for canvas to assign values for templates.

Parameters
string$actionAction string
int$idObject id (if ref not provided)
string$refObject ref (if id not provided)
Returns
void

Definition at line 150 of file canvas.class.php.

◆ display_canvas()

Canvas::display_canvas ( $action)

Display a canvas page.

This will include the template for output. Variables used by templates may have been defined or loaded before into the assign_values function.

Parameters
string$actionAction code
Returns
void

Definition at line 186 of file canvas.class.php.

References _cleanaction().

◆ displayCanvasExists()

Canvas::displayCanvasExists ( $action)

Return if a template exists to display as canvas (if it exists)

Parameters
string$actionAction code
Returns
int 0=Canvas template file does not exist, 1=Canvas template file exists

Definition at line 164 of file canvas.class.php.

References _cleanaction().

◆ doActions()

Canvas::doActions ( & $action = 'view',
$id = 0 )

Shared method for canvas to execute actions.

Deprecated
Use the doActions of hooks instead of this. This function is called if you add a doActions class inside your canvas. Try to not do that and add action code into a hook instead.
Parameters
string$actionAction string
int$idObject id
Returns
mixed Return return code of doActions of canvas
See also
https://wiki.dolibarr.org/index.php/Canvas_development

Definition at line 221 of file canvas.class.php.

◆ getCanvas()

Canvas::getCanvas ( $module,
$card,
$canvas )

Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir.

Parameters
string$moduleName of target module (thirdparty, contact, ...)
string$cardTab name of card (ex: 'card', 'info', 'contactcard', ...) or '' for a list page
string$canvasName of canvas (ex: mycanvas, default, or mycanvas@myexternalmodule)
Returns
void

Definition at line 100 of file canvas.class.php.

References dol_buildpath().

◆ hasActions()

Canvas::hasActions ( )

Return if a canvas contains an action controller.

Returns
boolean Return if canvas contains actions (old feature. now actions should be inside hooks)

Definition at line 205 of file canvas.class.php.


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