dolibarr  16.0.5
ecm.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
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  * or see https://www.gnu.org/
17  */
18 
32 function ecm_prepare_dasboard_head($object)
33 {
34  global $langs, $conf, $user, $form;
35  global $helptext1, $helptext2;
36 
37  $h = 0;
38  $head = array();
39  $helptext = $langs->trans("ECMAreaDesc").'<br>';
40  $helptext .= $langs->trans("ECMAreaDesc2");
41 
42  $head[$h][0] = DOL_URL_ROOT.'/ecm/index.php';
43  $head[$h][1] = $langs->trans("ECMSectionsManual").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3);
44  $head[$h][2] = 'index';
45  $h++;
46 
47  if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) {
48  $head[$h][0] = DOL_URL_ROOT.'/ecm/index_auto.php';
49  $head[$h][1] = $langs->trans("ECMSectionsAuto").$form->textwithpicto('', $helptext, 1, 'info', '', 0, 3);
50  $head[$h][2] = 'index_auto';
51  $h++;
52  }
53 
54  // Show more tabs from modules
55  // Entries must be declared in modules descriptor with line
56  // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
57  // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
58  complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm');
59 
60  complete_head_from_modules($conf, $langs, $object, $head, $h, 'ecm', 'remove');
61 
62  return $head;
63 }
64 
65 
74 function ecm_prepare_head($object, $module = 'ecm', $section = '')
75 {
76  global $langs, $conf, $user;
77  $h = 0;
78  $head = array();
79 
80  if ($module == 'ecm') {
81  $head[$h][0] = DOL_URL_ROOT.'/ecm/dir_card.php?section='.$object->id;
82  $head[$h][1] = $langs->trans("Directory");
83  $head[$h][2] = 'card';
84  $h++;
85  } else {
86  $head[$h][0] = DOL_URL_ROOT.'/ecm/dir_card.php?section='.$section.'&module='.$module;
87  $head[$h][1] = $langs->trans("Directory");
88  $head[$h][2] = 'card';
89  $h++;
90  }
91 
92  return $head;
93 }
94 
101 function ecm_file_prepare_head($object)
102 {
103  global $langs, $conf, $user;
104  $h = 0;
105  $head = array();
106 
107  $head[$h][0] = DOL_URL_ROOT.'/ecm/file_card.php?section='.$object->section_id.'&urlfile='.urlencode($object->label);
108  $head[$h][1] = $langs->trans("File");
109  $head[$h][2] = 'card';
110  $h++;
111 
112  // Notes
113  $head[$h][0] = DOL_URL_ROOT.'/ecm/file_note.php?section='.$object->section_id.'&urlfile='.urlencode($object->label);
114  $head[$h][1] = $langs->trans("Notes");
115  $nbNote = 0;
116  if (!empty($object->note_private)) {
117  $nbNote++;
118  }
119  if (!empty($object->note_public)) {
120  $nbNote++;
121  }
122  if ($nbNote > 0) {
123  $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
124  }
125  $head[$h][2] = 'note';
126  $h++;
127 
128  return $head;
129 }
130 
137 function ecm_prepare_head_fm($object)
138 {
139  global $langs, $conf;
140  $h = 0;
141  $head = array();
142 
143  $head[$h][0] = DOL_URL_ROOT.'/ecm/index.php?action=file_manager';
144  $head[$h][1] = $langs->trans('ECMFileManager');
145  $head[$h][2] = 'file_manager';
146  $h++;
147 
148  $head[$h][0] = DOL_URL_ROOT.'/ecm/search.php';
149  $head[$h][1] = $langs->trans('Search');
150  $head[$h][2] = 'search_form';
151  $h++;
152 
153  return $head;
154 }
155 
162 {
163  global $langs, $conf;
164  $langs->load("ecm");
165 
166  $h = 0;
167  $head = array();
168 
169  $head[$h][0] = DOL_URL_ROOT."/admin/ecm.php";
170  $head[$h][1] = $langs->trans("Setup");
171  $head[$h][2] = 'ecm';
172  $h++;
173 
174  $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php';
175  $head[$h][1] = $langs->trans("ExtraFieldsEcmFiles");
176  $head[$h][2] = 'attributes_ecm_files';
177  $h++;
178 
179  $head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php';
180  $head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories");
181  $head[$h][2] = 'attributes_ecm_directories';
182  $h++;
183 
184  complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin');
185 
186  complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin', 'remove');
187 
188  return $head;
189 }
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
complete_head_from_modules
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
Definition: functions.lib.php:9038
ecm_file_prepare_head
ecm_file_prepare_head($object)
Prepare array with list of tabs.
Definition: ecm.lib.php:101
ecm_prepare_dasboard_head
ecm_prepare_dasboard_head($object)
Prepare array with list of different ecm main dashboard.
Definition: ecm.lib.php:32
ecm_admin_prepare_head
ecm_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: ecm.lib.php:161
ecm_prepare_head_fm
ecm_prepare_head_fm($object)
Prepare array with list of tabs.
Definition: ecm.lib.php:137
ecm_prepare_head
ecm_prepare_head($object, $module='ecm', $section='')
Prepare array with list of tabs.
Definition: ecm.lib.php:74