45 public $errors = array();
100 $newaction = $action;
101 if ($newaction ==
'add') {
102 $newaction =
'create';
104 if ($newaction ==
'update') {
107 if (empty($newaction) || $newaction ==
'delete' || $newaction ==
'create_user' || $newaction ==
'presend' || $newaction ==
'send') {
124 global $conf, $langs;
127 $this->targetmodule = $module;
128 $this->canvas = $canvas;
130 $this->dirmodule = $module;
133 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $canvas, $regs)) {
134 $this->canvas = $regs[1];
135 $this->dirmodule = $regs[2];
138 if ($this->dirmodule ==
'thirdparty') {
139 $this->dirmodule =
'societe';
143 $controlclassfile =
dol_buildpath(
'/'.$this->dirmodule.
'/canvas/'.$this->canvas.
'/actions_'.$this->card.
'_'.$this->canvas.
'.class.php');
144 if (file_exists($controlclassfile)) {
146 require_once $controlclassfile;
149 $controlclassname =
'Actions'.ucfirst($this->card).ucfirst($this->canvas);
150 $this->control =
new $controlclassname($this->db, $this->dirmodule, $this->targetmodule, $this->canvas, $this->card);
154 $this->template_dir =
dol_buildpath(
'/'.$this->dirmodule.
'/canvas/'.$this->canvas.
'/tpl/');
155 if (!is_dir($this->template_dir)) {
156 $this->template_dir =
'';
175 if (is_object($this->control) && method_exists($this->control,
'assign_values')) {
176 $this->control->assign_values($action,
$id, $ref);
189 if (empty($this->template_dir)) {
193 if (file_exists($this->template_dir.(!empty($this->card) ? $this->card.
'_' :
'').$this->
_cleanaction($action).
'.tpl.php')) {
211 global $db, $conf, $langs, $user, $canvas;
212 global $form, $formfile;
215 include $this->template_dir.(!empty($this->card) ? $this->card.
'_' :
'').$this->
_cleanaction($action).
'.tpl.php';
229 return (is_object($this->control));
245 if (method_exists($this->control,
'doActions')) {
246 $ret = $this->control->doActions($action,
$id);
hasActions()
Return if a canvas contains an action controller.
getCanvas($module, $card, $canvas)
Initialize properties: ->targetmodule, ->canvas, ->card, ->dirmodule, ->template_dir.
_cleanaction($action)
Return action code cleaned.
__construct($db, $actiontype='view')
Constructor.
display_canvas($action)
Display a canvas page.
doActions(&$action='view', $id=0)
Shared method for canvas to execute actions.
displayCanvasExists($action)
Return if a template exists to display as canvas (if it exists)
assign_values(&$action='view', $id=0, $ref='')
Shared method for canvas to assign values for templates.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.