28require
'../../../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/modules/action/rapport.class.php';
36$langs->loadLangs(array(
"agenda",
"commercial"));
38$action =
GETPOST(
'action',
'aZ09');
39$month =
GETPOST(
'month',
'int');
42$optioncss =
GETPOST(
'optioncss',
'alpha');
43$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
44$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
45$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
46$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
47if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
51$offset = $limit * $page;
56 $sortfield =
"a.datep";
60$socid =
GETPOST(
'socid',
'int');
62 $socid = $user->socid;
65if ($user->socid && $socid) {
74if ($action ==
'builddoc') {
76 $result = $cat->write_file(
GETPOST(
'id',
'int'));
91$sql =
"SELECT count(*) as cc,";
92$sql .=
" date_format(a.datep, '%m/%Y') as df,";
93$sql .=
" date_format(a.datep, '%m') as month,";
94$sql .=
" date_format(a.datep, '%Y') as year";
95$sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a,";
96$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
97$sql .=
" WHERE a.fk_user_author = u.rowid";
98$sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
100$sql .=
" GROUP BY year, month, df";
101$sql .=
" ORDER BY year DESC, month DESC, df DESC";
103$nbtotalofrecords =
'';
105 $result = $db->query($sql);
106 $nbtotalofrecords = $db->num_rows($result);
107 if (($page * $limit) > $nbtotalofrecords) {
113$sql .= $db->plimit($limit + 1, $offset);
117$resql = $db->query($sql);
119 $num = $db->num_rows($resql);
122 if ($limit > 0 && $limit != $conf->liste_limit) {
123 $param .=
'&limit='.$limit;
126 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
127 if ($optioncss !=
'') {
128 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
130 print
'<input type="hidden" name="token" value="'.newToken().
'">';
131 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
132 print
'<input type="hidden" name="action" value="list">';
133 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
134 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
136 print_barre_liste($langs->trans(
"EventReports"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_agenda', 0,
'',
'', $limit, 0, 0, 1);
141 print
'<div class="div-table-responsive">';
142 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
144 print
'<tr class="liste_titre">';
145 print
'<td>'.$langs->trans(
"Period").
'</td>';
146 print
'<td class="center">'.$langs->trans(
"EventsNb").
'</td>';
147 print
'<td class="center">'.$langs->trans(
"Action").
'</td>';
148 print
'<td>'.$langs->trans(
"PDF").
'</td>';
149 print
'<td class="center">'.$langs->trans(
"Date").
'</td>';
150 print
'<td class="center">'.$langs->trans(
"Size").
'</td>';
153 while ($i < min($num, $limit)) {
154 $obj = $db->fetch_object($resql);
157 print
'<tr class="oddeven">';
160 print
"<td>".$obj->df.
"</td>\n";
163 print
'<td class="center">'.$obj->cc.
'</td>';
166 print
'<td class="center">';
167 print
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?action=builddoc&token='.newToken().
'&page='.((int) $page).
'&month='.((int) $obj->month).
'&year='.((int) $obj->year).
'">'.
img_picto($langs->trans(
'BuildDoc'),
'filenew').
'</a>';
170 $name =
"actions-".$obj->month.
"-".$obj->year.
".pdf";
171 $relativepath = $name;
172 $file = $conf->agenda->dir_temp.
"/".$name;
173 $modulepart =
'actionsreport';
174 $documenturl = DOL_URL_ROOT.
'/document.php';
175 if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
176 $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
179 if (file_exists($file)) {
180 print
'<td class="tdoverflowmax300">';
183 $filearray = array(
'name'=>basename($file),
'fullname'=>$file,
'type'=>
'file');
187 $out .=
'<a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
189 $out .=
' target="_blank" rel="noopener noreferrer">';
190 $out .=
img_mime($filearray[
"name"], $langs->trans(
"File").
': '.$filearray[
"name"]);
191 $out .= $filearray[
"name"];
193 $out .= $formfile->showPreview($filearray, $modulepart, $relativepath, 0, $param);
197 print
'<td class="center">'.dol_print_date(
dol_filemtime($file),
'dayhour').
'</td>';
198 print
'<td class="center">'.dol_print_size(
dol_filesize($file)).
'</td>';
200 print
'<td> </td>';
201 print
'<td> </td>';
202 print
'<td> </td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to generate event report.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.