Completed
Branch develop (420c52)
by
unknown
27:28
created

myobject.lib.php ➔ myobjectPrepareHead()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 41
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 24
nc 2
nop 1
dl 0
loc 41
rs 8.8571
c 0
b 0
f 0
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 <http://www.gnu.org/licenses/>.
16
 */
17
18
/**
19
 * \file    htdocs/modulebuilder/template/lib/myobject.lib.php
20
 * \ingroup mymodule
21
 * \brief   Library files with common functions for MyObject
22
 */
23
24
/**
25
 * Prepare array of tabs for MyObject
26
 *
27
 * @param	MyObject	$object		MyObject
28
 * @return 	array					Array of tabs
29
 */
30
function myobjectPrepareHead($object)
31
{
32
	global $langs, $conf;
33
34
	$langs->load("mymodule@mymodule");
35
36
	$h = 0;
37
	$head = array();
38
39
	$head[$h][0] = dol_buildpath("/mymodule/myobject_card.php", 1).'?id='.$object->id;
40
	$head[$h][1] = $langs->trans("Card");
41
	$head[$h][2] = 'card';
42
	$h++;
43
	if (isset($object->fields['note_public']) || isset($object->fields['note_pricate']))
44
	{
45
		$head[$h][0] = dol_buildpath("/mymodule/myobject_note.php", 1).'?id='.$object->id;
46
		$head[$h][1] = $langs->trans("Notes");
47
		$head[$h][2] = 'note';
48
		$h++;
49
	}
50
	$head[$h][0] = dol_buildpath("/mymodule/myobject_document.php", 1).'?id='.$object->id;
51
	$head[$h][1] = $langs->trans("Documents");
52
	$head[$h][2] = 'document';
53
	$h++;
54
	$head[$h][0] = dol_buildpath("/mymodule/myobject_agenda.php", 1).'?id='.$object->id;
55
	$head[$h][1] = $langs->trans("Events");
56
	$head[$h][2] = 'agenda';
57
	$h++;
58
59
	// Show more tabs from modules
60
	// Entries must be declared in modules descriptor with line
61
	//$this->tabs = array(
62
	//	'entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
63
	//); // to add new tab
64
	//$this->tabs = array(
65
	//	'entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
66
	//); // to remove a tab
67
	complete_head_from_modules($conf, $langs, $object, $head, $h, 'myobject@mymodule');
68
69
	return $head;
70
}
71