Canvas
class Canvas (View source)
Class to manage canvas
Properties
| DoliDB | $db | ||
| string | $error | ||
| string[] | $errors | ||
| string | $actiontype | ||
| string | $dirmodule | ||
| string | $targetmodule | ||
| string | $canvas | ||
| string | $card | ||
| string | $template_dir | ||
| ActionsContactCardCommon|ActionsAdherentCardCommon|ActionsCardProduct|ActionsCardService|ActionsCardCommon | $control |
Methods
Constructor
Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir
Shared method for canvas to assign values for templates
Return if a template exists to display as canvas (if it exists)
Display a canvas page. This will include the template for output.
Return if a canvas contains an action controller
Shared method for canvas to execute actions.
Details
__construct($db, string $actiontype = 'view')
Constructor
@param DoliDB $db Database handler
getCanvas($module, string $card, $canvas)
Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir
@param string $module Name of target module (thirdparty, contact, ...)
assign_values($action = 'view', int $id = 0, $ref = '')
Shared method for canvas to assign values for templates
@param string $action Action string
int
displayCanvasExists(string $action)
Return if a template exists to display as canvas (if it exists)
void
display_canvas(string $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.
hasActions()
Return if a canvas contains an action controller
@return boolean Return if canvas contains actions (old feature. now actions should be inside hooks)
doActions(string $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.