26require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
46 public $errors = array();
52 public $results = array();
86 public function getNomUrl($parameters, &$object, &$action)
88 global $db, $langs, $conf, $user;
89 $this->resprints =
'';
102 public function doActions($parameters, &$object, &$action, $hookmanager)
104 global $conf, $user, $langs;
109 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
115 $this->results = array(
'myreturn' => 999);
116 $this->resprints =
'A text to show';
119 $this->errors[] =
'Error message';
134 public function doMassActions($parameters, &$object, &$action, $hookmanager)
136 global $conf, $user, $langs;
141 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
142 foreach ($parameters[
'toselect'] as $objectid) {
148 $this->results = array(
'myreturn' => 999);
149 $this->resprints =
'A text to show';
152 $this->errors[] =
'Error message';
169 global $conf, $user, $langs;
175 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
176 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
182 $this->errors[] =
'Error message';
201 global $conf, $user, $langs;
204 $outputlangs = $langs;
208 dol_syslog(get_class($this).
'::executeHooks action='.$action);
211 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
229 global $conf, $user, $langs;
232 $outputlangs = $langs;
236 dol_syslog(get_class($this).
'::executeHooks action='.$action);
239 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
258 global $conf, $user, $langs;
260 $langs->load(
"mymodule@mymodule");
262 $this->results = array();
267 if ($parameters[
'tabfamily'] ==
'mymodule') {
269 $head[$h][1] = $langs->trans(
"Home");
270 $head[$h][2] =
'home';
273 $this->results[
'title'] = $langs->trans(
"MyModule");
274 $this->results[
'picto'] =
'mymodule@mymodule';
277 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
278 $head[$h][1] = $langs->trans(
"CustomReports");
279 $head[$h][2] =
'customreports';
281 $this->results[
'head'] = $head;
302 if ($parameters[
'features'] ==
'myobject') {
303 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
304 $this->results[
'result'] = 1;
307 $this->results[
'result'] = 0;
328 global $langs, $conf, $user;
330 if (!isset($parameters[
'object']->element)) {
333 if ($parameters[
'mode'] ==
'remove') {
336 } elseif ($parameters[
'mode'] ==
'add') {
337 $langs->load(
'mymodule@mymodule');
339 $counter = count($parameters[
'head']);
340 $element = $parameters[
'object']->element;
341 $id = $parameters[
'object']->id;
344 if (in_array($element, [
'context1',
'context2'])) {
347 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' . $id .
'&module='.$element;
348 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
349 if ($datacount > 0) {
350 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
352 $parameters[
'head'][$counter][2] =
'mymoduleemails';
355 if ($counter > 0 && (
int) DOL_VERSION < 14) {
356 $this->results = $parameters[
'head'];
__construct($db)
Constructor.
doActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below.
loadDataForCustomReports($parameters, &$action, $hookmanager)
Overloading the loadDataForCustomReports function : returns data to complete the customreport tool.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the doMassActions function : replacing the parent's function with the one below.
restrictedArea($parameters, &$action, $hookmanager)
Overloading the restrictedArea function : check permission on an object.
afterPDFCreation($parameters, &$pdfhandler, &$action)
Execute action.
completeTabsHead(&$parameters, &$object, &$action, $hookmanager)
Execute action completeTabsHead.
beforePDFCreation($parameters, &$object, &$action)
Execute action.
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the addMoreMassActions function : replacing the parent's function with the one below.
getNomUrl($parameters, &$object, &$action)
Execute action.
Parent class of all other hook actions classes.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.