dolibarr  13.0.2
emailcollector.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) ---Put here your own copyright and developer email---
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  */
17 
31 function emailcollectorPrepareHead($object)
32 {
33  global $db, $langs, $conf;
34 
35  $langs->load("emailcollector@emailcollector");
36 
37  $h = 0;
38  $head = array();
39 
40  $head[$h][0] = dol_buildpath("/admin/emailcollector_card.php", 1).'?id='.$object->id;
41  $head[$h][1] = $langs->trans("EmailCollector");
42  $head[$h][2] = 'card';
43  $h++;
44 
45  /*if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
46  {
47  $nbNote = 0;
48  if (!empty($object->note_private)) $nbNote++;
49  if (!empty($object->note_public)) $nbNote++;
50  $head[$h][0] = dol_buildpath('/emailcollector/emailcollector_note.php', 1).'?id='.$object->id;
51  $head[$h][1] = $langs->trans('Notes');
52  if ($nbNote > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
53  $head[$h][2] = 'note';
54  $h++;
55  }*/
56 
57  /*require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
58  require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
59  $upload_dir = $conf->emailcollector->dir_output . "/emailcollector/" . dol_sanitizeFileName($object->ref);
60  $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$'));
61  $nbLinks=Link::count($db, $object->element, $object->id);
62  $head[$h][0] = dol_buildpath("/emailcollector/emailcollector_document.php", 1).'?id='.$object->id;
63  $head[$h][1] = $langs->trans('Documents');
64  if (($nbFiles+$nbLinks) > 0) $head[$h][1].= '<span class="badge marginleftonlyshort">'.($nbFiles+$nbLinks).'</span>';
65  $head[$h][2] = 'document';
66  $h++;
67 
68  $head[$h][0] = dol_buildpath("/emailcollector/emailcollector_agenda.php", 1).'?id='.$object->id;
69  $head[$h][1] = $langs->trans("Events");
70  $head[$h][2] = 'agenda';
71  $h++;
72  */
73 
74  // Show more tabs from modules
75  // Entries must be declared in modules descriptor with line
76  //$this->tabs = array(
77  // 'entity:+tabname:Title:@emailcollector:/emailcollector/mypage.php?id=__ID__'
78  //); // to add new tab
79  //$this->tabs = array(
80  // 'entity:-tabname:Title:@emailcollector:/emailcollector/mypage.php?id=__ID__'
81  //); // to remove a tab
82  complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailcollector');
83 
84  complete_head_from_modules($conf, $langs, $object, $head, $h, 'emailcollector', 'remove');
85 
86  return $head;
87 }
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
emailcollectorPrepareHead($object)
Prepare array of tabs for EmailCollector.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).