29require
'../../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
44$langs->loadLangs(array(
"agenda",
"commercial"));
46$action =
GETPOST(
'action',
'aZ09');
50$optioncss =
GETPOST(
'optioncss',
'alpha');
52$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
53$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
55if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
59$offset = $limit * $page;
64 $sortfield =
"a.datep";
69if (!$user->hasRight(
"agenda",
"allactions",
"read")) {
78if ($action ==
'builddoc' && $user->hasRight(
"agenda",
"allactions",
"read")) {
79 require_once DOL_DOCUMENT_ROOT.
'/core/modules/action/doc/pdf_standard_actions.class.php';
82 $result = $cat->write_file(
null, $langs);
97$sql =
"SELECT count(*) as cc,";
98$sql .=
" date_format(a.datep, '%m/%Y') as df,";
99$sql .=
" date_format(a.datep, '%m') as month,";
100$sql .=
" date_format(a.datep, '%Y') as year";
101$sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm as a,";
102$sql .=
" ".MAIN_DB_PREFIX.
"user as u";
103$sql .=
" WHERE a.fk_user_author = u.rowid";
104$sql .=
' AND a.entity IN ('.getEntity(
'agenda').
')';
106$sql .=
" GROUP BY year, month, df";
107$sql .=
" ORDER BY year DESC, month DESC, df DESC";
109$nbtotalofrecords =
'';
111 $result = $db->query($sql);
112 $nbtotalofrecords = $db->num_rows($result);
113 if (($page * $limit) > $nbtotalofrecords) {
119$sql .= $db->plimit($limit + 1, $offset);
123$resql = $db->query($sql);
125 $num = $db->num_rows($resql);
128 if ($limit > 0 && $limit !=
$conf->liste_limit) {
129 $param .=
'&limit='.$limit;
132 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
133 if ($optioncss !=
'') {
134 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
136 print
'<input type="hidden" name="token" value="'.newToken().
'">';
137 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
138 print
'<input type="hidden" name="action" value="list">';
139 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
140 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
143 print_barre_liste($langs->trans(
"EventReports"), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'title_agenda', 0,
'',
'', $limit, 0, 0, 1);
148 print
'<div class="div-table-responsive">';
149 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
151 print
'<tr class="liste_titre">';
152 print
'<td>'.$langs->trans(
"Period").
'</td>';
153 print
'<td class="center">'.$langs->trans(
"EventsNb").
'</td>';
154 print
'<td class="center">'.$langs->trans(
"Action").
'</td>';
155 print
'<td>'.$langs->trans(
"PDF").
'</td>';
156 print
'<td class="center">'.$langs->trans(
"Date").
'</td>';
157 print
'<td class="center">'.$langs->trans(
"Size").
'</td>';
160 while ($i < min($num, $limit)) {
161 $obj = $db->fetch_object($resql);
164 print
'<tr class="oddeven">';
167 print
"<td>".$obj->df.
"</td>\n";
170 print
'<td class="center">'.$obj->cc.
'</td>';
173 print
'<td class="center">';
174 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>';
177 $name =
"actions-".$obj->month.
"-".$obj->year.
".pdf";
178 $relativepath = $name;
179 $file =
$conf->agenda->dir_temp.
"/".$name;
180 $modulepart =
'actionsreport';
181 $documenturl = DOL_URL_ROOT.
'/document.php';
182 if (isset(
$conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) {
186 if (file_exists($file)) {
187 print
'<td class="tdoverflowmax300">';
190 $filearray = array(
'name' => basename($file),
'fullname' => $file,
'type' =>
'file');
194 $out .=
'<a href="'.$documenturl.
'?modulepart='.$modulepart.
'&file='.urlencode($relativepath).($param ?
'&'.$param :
'').
'"';
196 $out .=
' target="_blank" rel="noopener noreferrer">';
197 $out .=
img_mime($filearray[
"name"], $langs->trans(
"File").
': '.$filearray[
"name"]);
198 $out .= $filearray[
"name"];
200 $out .= $formfile->showPreview($filearray, $modulepart, $relativepath, 0, $param);
204 print
'<td class="center">'.dol_print_date(
dol_filemtime($file),
'dayhour').
'</td>';
205 print
'<td class="center">'.dol_print_size(
dol_filesize($file)).
'</td>';
207 print
'<td> </td>';
208 print
'<td> </td>';
209 print
'<td> </td>';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to generate event report.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
img_mime($file, $titlealt='', $morecss='')
Show MIME img of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.