dolibarr  7.0.0-beta
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 the template to display 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

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

Constructor.

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

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

References _cleanaction().

Member Function Documentation

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 65 of file canvas.class.php.

Referenced by __construct(), and display_canvas().

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 133 of file canvas.class.php.

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 159 of file canvas.class.php.

References $form, and _cleanaction().

Canvas::displayCanvasExists (   $action)

Return the template to display 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 144 of file canvas.class.php.

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
http://wiki.dolibarr.org/index.php/Canvas_development

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

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)
Returns
void

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

References dol_buildpath().

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 176 of file canvas.class.php.


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