27require_once DOL_DOCUMENT_ROOT.
'/core/class/commonhookactions.class.php';
47 public $errors = array();
53 public $results = array();
89 global $db, $langs,
$conf, $user;
90 $this->resprints =
'';
108 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
113 $this->results = array(
'myreturn' => 999);
114 $this->resprints =
'A text to show';
117 $this->errors[] =
'Error message';
137 global
$conf, $user, $langs;
142 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
144 foreach ($parameters[
'toselect'] as $objectid) {
149 $this->results = array(
'myreturn' => 999);
150 $this->resprints =
'A text to show';
153 $this->errors[] =
'Error message';
173 global
$conf, $user, $langs;
179 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
180 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
186 $this->errors[] =
'Error message';
205 global
$conf, $user, $langs;
208 $outputlangs = $langs;
212 dol_syslog(get_class($this).
'::executeHooks action='.$action);
216 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
235 global
$conf, $user, $langs;
238 $outputlangs = $langs;
242 dol_syslog(get_class($this).
'::executeHooks action='.$action);
246 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
267 $langs->load(
"mymodule@mymodule");
269 $this->results = array();
274 if ($parameters[
'tabfamily'] ==
'mymodule') {
276 $head[$h][1] = $langs->trans(
"Home");
277 $head[$h][2] =
'home';
280 $this->results[
'title'] = $langs->trans(
"MyModule");
281 $this->results[
'picto'] =
'mymodule@mymodule';
284 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
285 $head[$h][1] = $langs->trans(
"CustomReports");
286 $head[$h][2] =
'customreports';
288 $this->results[
'head'] = $head;
290 $arrayoftypes = array();
293 $this->results[
'arrayoftype'] = $arrayoftypes;
315 if ($parameters[
'features'] ==
'myobject') {
316 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
317 $this->results[
'result'] = 1;
320 $this->results[
'result'] = 0;
341 global $langs,
$conf, $user;
343 if (!isset($parameters[
'object']->element)) {
346 if ($parameters[
'mode'] ==
'remove') {
349 } elseif ($parameters[
'mode'] ==
'add') {
350 $langs->load(
'mymodule@mymodule');
352 $counter = count($parameters[
'head']);
353 $element = $parameters[
'object']->element;
354 $id = $parameters[
'object']->id;
357 if (in_array($element, [
'context1',
'context2'])) {
360 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' .
$id .
'&module='.$element;
361 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
362 if ($datacount > 0) {
363 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
365 $parameters[
'head'][$counter][2] =
'mymoduleemails';
368 if ($counter > 0 && (
int) DOL_VERSION < 14) {
369 $this->results = $parameters[
'head'];
395 $this->results = array(
'myobject@mymodule' => array(
396 'enabled' => isModEnabled(
'mymodule'),
398 'label' =>
'LinkToMyObject',
399 '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( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...