44 public $errors = array();
50 public $results = array();
84 public function getNomUrl($parameters, &$object, &$action)
86 global $db, $langs, $conf, $user;
87 $this->resprints =
'';
100 public function doActions($parameters, &$object, &$action, $hookmanager)
102 global $conf, $user, $langs;
107 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';
132 public function doMassActions($parameters, &$object, &$action, $hookmanager)
134 global $conf, $user, $langs;
139 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
140 foreach ($parameters[
'toselect'] as $objectid) {
146 $this->results = array(
'myreturn' => 999);
147 $this->resprints =
'A text to show';
150 $this->errors[] =
'Error message';
167 global $conf, $user, $langs;
173 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
174 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"MyModuleMassAction").
'</option>';
180 $this->errors[] =
'Error message';
199 global $conf, $user, $langs;
202 $outputlangs = $langs;
204 $ret = 0; $deltemp = array();
205 dol_syslog(get_class($this).
'::executeHooks action='.$action);
208 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
226 global $conf, $user, $langs;
229 $outputlangs = $langs;
231 $ret = 0; $deltemp = array();
232 dol_syslog(get_class($this).
'::executeHooks action='.$action);
235 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
254 global $conf, $user, $langs;
256 $langs->load(
"mymodule@mymodule");
258 $this->results = array();
263 if ($parameters[
'tabfamily'] ==
'mymodule') {
265 $head[$h][1] = $langs->trans(
"Home");
266 $head[$h][2] =
'home';
269 $this->results[
'title'] = $langs->trans(
"MyModule");
270 $this->results[
'picto'] =
'mymodule@mymodule';
273 $head[$h][0] =
'customreports.php?objecttype='.$parameters[
'objecttype'].(empty($parameters[
'tabfamily']) ?
'' :
'&tabfamily='.$parameters[
'tabfamily']);
274 $head[$h][1] = $langs->trans(
"CustomReports");
275 $head[$h][2] =
'customreports';
277 $this->results[
'head'] = $head;
298 if ($parameters[
'features'] ==
'myobject') {
299 if ($user->hasRight(
'mymodule',
'myobject',
'read')) {
300 $this->results[
'result'] = 1;
303 $this->results[
'result'] = 0;
324 global $langs, $conf, $user;
326 if (!isset($parameters[
'object']->element)) {
329 if ($parameters[
'mode'] ==
'remove') {
332 } elseif ($parameters[
'mode'] ==
'add') {
333 $langs->load(
'mymodule@mymodule');
335 $counter = count($parameters[
'head']);
336 $element = $parameters[
'object']->element;
337 $id = $parameters[
'object']->id;
340 if (in_array($element, [
'context1',
'context2'])) {
343 $parameters[
'head'][$counter][0] =
dol_buildpath(
'/mymodule/mymodule_tab.php', 1) .
'?id=' . $id .
'&module='.$element;
344 $parameters[
'head'][$counter][1] = $langs->trans(
'MyModuleTab');
345 if ($datacount > 0) {
346 $parameters[
'head'][$counter][1] .=
'<span class="badge marginleftonlyshort">' . $datacount .
'</span>';
348 $parameters[
'head'][$counter][2] =
'mymoduleemails';
351 if ($counter > 0 && (
int) DOL_VERSION < 14) {
352 $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.
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.