-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlist.php
118 lines (93 loc) · 3.33 KB
/
list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
require 'config.php';
dol_include_once('/reloadcustom/class/reloadcustom.class.php');
if(empty($user->rights->reloadcustom->read)) accessforbidden();
$langs->load('abricot@abricot');
$langs->load('reloadcustom@reloadcustom');
$PDOdb = new TPDOdb;
$object = new TReloadCustom;
$hookmanager->initHooks(array('reloadcustomlist'));
/*
* Actions
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// do action from GETPOST ...
}
/*
* View
*/
llxHeader('',$langs->trans('ReloadCustomList'),'','');
//$type = GETPOST('type');
//if (empty($user->rights->reloadcustom->all->read)) $type = 'mine';
// TODO ajouter les champs de son objet que l'on souhaite afficher
$sql = 'SELECT t.rowid, t.ref, t.label, t.date_cre, t.date_maj, \'\' AS action';
$sql.= ' FROM '.MAIN_DB_PREFIX.'reloadcustom t ';
$sql.= ' WHERE 1=1';
//$sql.= ' AND t.entity IN ('.getEntity('ReloadCustom', 1).')';
//if ($type == 'mine') $sql.= ' AND t.fk_user = '.$user->id;
$formcore = new TFormCore($_SERVER['PHP_SELF'], 'form_list_reloadcustom', 'GET');
$nbLine = !empty($user->conf->MAIN_SIZE_LISTE_LIMIT) ? $user->conf->MAIN_SIZE_LISTE_LIMIT : $conf->global->MAIN_SIZE_LISTE_LIMIT;
$r = new TListviewTBS('reloadcustom');
echo $r->render($PDOdb, $sql, array(
'view_type' => 'list' // default = [list], [raw], [chart]
,'limit'=>array(
'nbLine' => $nbLine
)
,'subQuery' => array()
,'link' => array()
,'type' => array(
'date_cre' => 'date' // [datetime], [hour], [money], [number], [integer]
,'date_maj' => 'date'
)
,'search' => array(
'date_cre' => array('recherche' => 'calendars', 'allow_is_null' => true)
,'date_maj' => array('recherche' => 'calendars', 'allow_is_null' => false)
,'ref' => array('recherche' => true, 'table' => 't', 'field' => 'ref')
,'label' => array('recherche' => true, 'table' => array('t', 't'), 'field' => array('label', 'description')) // input text de recherche sur plusieurs champs
,'status' => array('recherche' => TReloadcustom::$TStatus, 'to_translate' => true) // select html, la clé = le status de l'objet, 'to_translate' à true si nécessaire
)
,'translate' => array()
,'hide' => array(
'rowid'
)
,'liste' => array(
'titre' => $langs->trans('ReloadCustomList')
,'image' => img_picto('','title_generic.png', '', 0)
,'picto_precedent' => '<'
,'picto_suivant' => '>'
,'noheader' => 0
,'messageNothing' => $langs->trans('NoReloadCustom')
,'picto_search' => img_picto('','search.png', '', 0)
)
,'title'=>array(
'ref' => $langs->trans('Ref.')
,'label' => $langs->trans('Label')
,'date_cre' => $langs->trans('DateCre')
,'date_maj' => $langs->trans('DateMaj')
)
,'eval'=>array(
// 'fk_user' => '_getUserNomUrl(@val@)' // Si on a un fk_user dans notre requête
)
));
$parameters=array('sql'=>$sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
$formcore->end_form();
llxFooter('');
/**
* TODO remove if unused
*/
function _getUserNomUrl($fk_user)
{
global $db;
$u = new User($db);
if ($u->fetch($fk_user) > 0)
{
return $u->getNomUrl(1);
}
return '';
}