28require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
48 public $errors = array();
54 public $results = array();
90 global $db, $langs,
$conf, $user;
91 $this->resprints =
'';
109 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
114 $this->results = array(
'myreturn' => 999);
115 $this->resprints =
'A text to show';
118 $this->errors[] =
'Error message';
138 global
$conf, $user, $langs;
143 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
145 foreach ($parameters[
'toselect'] as $objectid) {
150 $this->results = array(
'myreturn' => 999);
151 $this->resprints =
'A text to show';
154 $this->errors[] =
'Error message';
180 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
181 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
187 $this->errors[] =
'Error message';
206 global
$conf, $user, $langs;
209 $outputlangs = $langs;
213 dol_syslog(get_class($this).
'::executeHooks action='.$action);
217 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
236 global
$conf, $user, $langs;
239 $outputlangs = $langs;
243 dol_syslog(get_class($this).
'::executeHooks action='.$action);
247 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
268 $langs->load(
"mymodule@mymodule");
270 $this->results = array();
275 if ($parameters[
'tabfamily'] ==
'mymodule') {
277 $head[$h][1] = $langs->trans(
"Home");
278 $head[$h][2] =
'home';
281 $this->results[
'title'] = $langs->trans(
"MyModule");
282 $this->results[
'picto'] =
'mymodule@mymodule';
285 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
286 $head[$h][1] = $langs->trans(
"CustomReports");
287 $head[$h][2] =
'customreports';
289 $this->results[
'head'] = $head;
291 $arrayoftypes = array();
294 $this->results[
'arrayoftype'] = $arrayoftypes;
316 if ($parameters[
'features'] ==
'myobject') {
317 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
318 $this->results[
'result'] = 1;
321 $this->results[
'result'] = 0;
342 global $langs,
$conf, $user;
344 if (!isset($parameters[
'object']->element)) {
347 if ($parameters[
'mode'] ==
'remove') {
350 } elseif ($parameters[
'mode'] ==
'add') {
351 $langs->load(
'mymodule@mymodule');
353 $counter = count($parameters[
'head']);
354 $element = $parameters[
'object']->element;
355 $id = $parameters[
'object']->id;
358 if (in_array($element, [
'context1',
'context2'])) {
361 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' .
$id .
'&module='.$element;
362 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
363 if ($datacount > 0) {
364 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
366 $parameters[
'head'][$counter][2] =
'mymoduleemails';
369 if ($counter > 0 && (
int) DOL_VERSION < 14) {
370 $this->results = $parameters[
'head'];
396 $this->results = array(
'myobject@mymodule' => array(
399 'label' =>
'LinkToMyObject',
400 'sql' =>
"SELECT t.rowid, t.ref, t.ref as 'name' FROM " . $this->db->prefix() . $myobject->table_element.
" as t "),);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
__construct($db)
Constructor.
doActions($parameters, &$object, &$action, $hookmanager)
Overload the doActions function : replacing the parent's function with the one below.
loadDataForCustomReports($parameters, &$action, $hookmanager)
Overload the loadDataForCustomReports function : returns data to complete the customreport tool.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overload the doMassActions function : replacing the parent's function with the one below.
afterPDFCreation($parameters, &$pdfhandler, &$action)
Execute action after PDF (document) creation.
restrictedArea($parameters, $object, &$action, $hookmanager)
Overload the restrictedArea function : check permission on an object.
completeTabsHead(&$parameters, &$object, &$action, $hookmanager)
Execute action completeTabsHead.
beforePDFCreation($parameters, &$object, &$action)
Execute action before PDF (document) creation.
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overload the addMoreMassActions function : replacing the parent's function with the one below.
getNomUrl($parameters, &$object, &$action)
Execute action.
showLinkToObjectBlock($parameters, &$object, &$action, $hookmanager)
Overload the showLinkToObjectBlock function : add or replace array of object linkable.
Parent class of all other hook actions classes.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.