dolibarr  21.0.0-alpha
Public Member Functions | Private Member Functions | List of all members
Canvas Class Reference

Class to manage canvas. More...

Public Member Functions

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

Private Member Functions

 _cleanaction ($action)
 Return action code cleaned. More...
 

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().

◆ 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.

◆ 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.

◆ 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.

◆ 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: