list.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <?php
  2. /* Copyright (C) 2013-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/opensurvey/list.php
  20. * \ingroup opensurvey
  21. * \brief Page to list surveys
  22. */
  23. require '../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  25. require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  26. require_once DOL_DOCUMENT_ROOT."/opensurvey/class/opensurveysondage.class.php";
  27. // Load translation files required by the page
  28. $langs->load("opensurvey");
  29. $action = GETPOST('action','aZ09')?GETPOST('action','aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  30. $massaction = GETPOST('massaction','alpha'); // The bulk action (combo box choice into lists)
  31. $show_files = GETPOST('show_files','int'); // Show files area generated by bulk actions ?
  32. $confirm = GETPOST('confirm','alpha'); // Result of a confirmation
  33. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  34. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  35. $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search
  36. $backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated page
  37. $optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print')
  38. $id=GETPOST('id','alpha');
  39. $search_ref = GETPOST('search_ref', 'alpha');
  40. $search_title = GETPOST('search_title', 'alpha');
  41. $search_status = GETPOST('search_status', 'alpha');
  42. // Load variable for pagination
  43. $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
  44. $sortfield = GETPOST('sortfield','alpha');
  45. $sortorder = GETPOST('sortorder','alpha');
  46. $page = GETPOST('page','int');
  47. if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
  48. $offset = $limit * $page;
  49. $pageprev = $page - 1;
  50. $pagenext = $page + 1;
  51. // Initialize technical objects
  52. $object = new Opensurveysondage($db);
  53. $opensurvey_static = new Opensurveysondage($db);
  54. $extrafields = new ExtraFields($db);
  55. $diroutputmassaction = $conf->opensurvey->dir_output . '/temp/massgeneration/'.$user->id;
  56. $hookmanager->initHooks(array('surveylist')); // Note that conf->hooks_modules contains array
  57. // Fetch optionals attributes and labels
  58. $extralabels = $extrafields->fetch_name_optionals_label('survey'); // Load $extrafields->attributes['myobject']
  59. $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,'','search_');
  60. // Default sort order (if not yet defined by previous GETPOST)
  61. if (! $sortfield) $sortfield="p.date_fin";
  62. if (! $sortorder) $sortorder="DESC";
  63. // Security check
  64. if (!$user->rights->opensurvey->read) accessforbidden();
  65. // Definition of fields for list
  66. $arrayfields=array();
  67. foreach($object->fields as $key => $val)
  68. {
  69. // If $val['visible']==0, then we never show the field
  70. if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
  71. }
  72. // Extra fields
  73. if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
  74. {
  75. foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
  76. {
  77. if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
  78. $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
  79. }
  80. }
  81. $object->fields = dol_sort_array($object->fields, 'position');
  82. $arrayfields = dol_sort_array($arrayfields, 'position');
  83. /*
  84. * Actions
  85. */
  86. if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
  87. if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
  88. $parameters=array();
  89. $reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  90. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  91. if (empty($reshook))
  92. {
  93. // Selection of new fields
  94. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  95. // Purge search criteria
  96. if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
  97. {
  98. $search_status='';
  99. $search_title='';
  100. $search_ref='';
  101. $toselect='';
  102. $search_array_options=array();
  103. }
  104. if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')
  105. || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha'))
  106. {
  107. $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  108. }
  109. // Mass actions
  110. $objectclass='Opensurveysondage';
  111. $objectlabel='Opensurveysondage';
  112. $permtoread = $user->rights->opensurvey->read;
  113. $permtodelete = $user->rights->opensurvey->write;
  114. $uploaddir = $conf->opensurvey->dir_output;
  115. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  116. }
  117. /*
  118. * View
  119. */
  120. $form=new Form($db);
  121. $now = dol_now();
  122. //$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
  123. $help_url='';
  124. $title = $langs->trans('OpenSurveyArea');
  125. $sql = "SELECT p.id_sondage as rowid, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,";
  126. $sql.= " u.login, u.firstname, u.lastname";
  127. $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p";
  128. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON u.rowid = p.fk_user_creat";
  129. $sql.= " WHERE p.entity IN (".getEntity('survey').")";
  130. if ($search_status != '-1' && $search_status != '') $sql.=natural_search("p.status", $search_status, 2);
  131. if ($search_expired == 'expired') $sql.=" AND p.date_fin < '".$db->idate($now)."'";
  132. if ($search_expired == 'opened') $sql.=" AND p.date_fin >= '".$db->idate($now)."'";
  133. if ($search_ref) $sql.=natural_search("p.id_sondage", $search_ref);
  134. if ($search_title) $sql.=natural_search("p.titre", $search_title);
  135. // Add where from extra fields
  136. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  137. // Add where from hooks
  138. $parameters=array();
  139. $reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
  140. $sql.=$hookmanager->resPrint;
  141. $sql.=$db->order($sortfield,$sortorder);
  142. // Count total nb of records
  143. $nbtotalofrecords = '';
  144. if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
  145. {
  146. $resql = $db->query($sql);
  147. $nbtotalofrecords = $db->num_rows($resql);
  148. if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
  149. {
  150. $page = 0;
  151. $offset = 0;
  152. }
  153. }
  154. // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
  155. if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
  156. {
  157. $num = $nbtotalofrecords;
  158. }
  159. else
  160. {
  161. $sql.= $db->plimit($limit+1, $offset);
  162. $resql=$db->query($sql);
  163. if (! $resql)
  164. {
  165. dol_print_error($db);
  166. exit;
  167. }
  168. $num = $db->num_rows($resql);
  169. }
  170. // Direct jump if only one record found
  171. if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
  172. {
  173. $obj = $db->fetch_object($resql);
  174. $id = $obj->rowid;
  175. header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.$id);
  176. exit;
  177. }
  178. llxHeader('', $title, $help_url);
  179. $arrayofselected=is_array($toselect)?$toselect:array();
  180. $param='';
  181. if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
  182. if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
  183. $fieldtosortuser=empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?'firstname':'lastname';
  184. if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
  185. // Add $param from extra fields
  186. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  187. // List of mass actions available
  188. $arrayofmassactions = array(
  189. //'presend'=>$langs->trans("SendByMail"),
  190. //'builddoc'=>$langs->trans("PDFMerge"),
  191. );
  192. if ($user->rights->opensurvey->write) $arrayofmassactions['predelete']=$langs->trans("Delete");
  193. if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
  194. $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
  195. // List of surveys into database
  196. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  197. if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  198. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  199. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  200. print '<input type="hidden" name="action" value="list">';
  201. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  202. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  203. print '<input type="hidden" name="page" value="'.$page.'">';
  204. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  205. $newcardbutton='';
  206. if (! empty($user->rights->opensurvey->write))
  207. {
  208. $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/opensurvey/wizard/index.php"><span class="valignmiddle">'.$langs->trans('NewSurvey').'</span>';
  209. $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
  210. $newcardbutton.= '</a>';
  211. }
  212. else
  213. {
  214. $newcardbutton='<a class="butActionNewRefused" href="#">'.$langs->trans('NewSurvey');
  215. $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
  216. $newcardbutton.= '</a>';
  217. }
  218. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
  219. // Add code for pre mass action (confirmation or email presend form)
  220. $topicmail="SendOpenSurveyRef";
  221. $modelmail="opensurvey";
  222. $objecttmp=new Opensurveysondage($db);
  223. $trackid='surv'.$object->id;
  224. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  225. if ($sall)
  226. {
  227. foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
  228. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
  229. }
  230. $moreforfilter = '';
  231. /*$moreforfilter.='<div class="divsearchfield">';
  232. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  233. $moreforfilter.= '</div>';*/
  234. $parameters=array();
  235. $reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  236. if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
  237. else $moreforfilter = $hookmanager->resPrint;
  238. if (! empty($moreforfilter))
  239. {
  240. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  241. print $moreforfilter;
  242. print '</div>';
  243. }
  244. $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
  245. //$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
  246. $selectedfields='';
  247. $selectedfields.=(count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  248. print '<div class="div-table-responsive">';
  249. print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
  250. // Fields title search
  251. // --------------------------------------------------------------------
  252. print '<tr class="liste_titre_filter">';
  253. print '<td class="liste_titre"><input type="text" class="maxwidth100" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
  254. print '<td class="liste_titre"><input type="text" class="maxwidth100onsmartphone" name="search_title" value="'.dol_escape_htmltag($search_title).'"></td>';
  255. print '<td class="liste_titre"></td>';
  256. print '<td class="liste_titre"></td>';
  257. print '<td class="liste_titre"></td>';
  258. print '<td class="liste_titre"></td>';
  259. $arraystatus=array('-1'=>'&nbsp;','0'=>$langs->trans("Draft"),'1'=>$langs->trans("Opened"),'2'=>$langs->trans("Closed"));
  260. print '<td class="liste_titre" align="center">'. $form->selectarray('search_status', $arraystatus, $search_status).'</td>';
  261. // Extra fields
  262. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  263. // Fields from hook
  264. $parameters=array('arrayfields'=>$arrayfields);
  265. $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
  266. print $hookmanager->resPrint;
  267. // Action column
  268. print '<td class="liste_titre" align="right">';
  269. $searchpicto=$form->showFilterButtons();
  270. print $searchpicto;
  271. print '</td>';
  272. print '</tr>'."\n";
  273. // Fields title label
  274. // --------------------------------------------------------------------
  275. print '<tr class="liste_titre">';
  276. print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.id_sondage", $param,"","",$sortfield,$sortorder);
  277. print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "p.titre", $param,"","",$sortfield,$sortorder);
  278. print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "p.format", $param,"","",$sortfield,$sortorder);
  279. print_liste_field_titre("Author", $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $param,"","",$sortfield,$sortorder);
  280. print_liste_field_titre("NbOfVoters", $_SERVER["PHP_SELF"], "", $param,"",'align="right"',$sortfield,$sortorder);
  281. print_liste_field_titre("ExpireDate", $_SERVER["PHP_SELF"], "p.date_fin", $param,"",'align="center"',$sortfield,$sortorder);
  282. print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.status", $param,"",'align="center"',$sortfield,$sortorder);
  283. // Extra fields
  284. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  285. // Hook fields
  286. $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
  287. $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
  288. print $hookmanager->resPrint;
  289. print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";
  290. print '</tr>'."\n";
  291. // Loop on record
  292. // --------------------------------------------------------------------
  293. $i=0;
  294. $totalarray=array();
  295. while ($i < min($num, $limit))
  296. {
  297. $obj = $db->fetch_object($resql);
  298. if (empty($obj)) break; // Should not happen
  299. $sql2='select COUNT(*) as nb from '.MAIN_DB_PREFIX."opensurvey_user_studs where id_sondage='".$db->escape($obj->id_sondage)."'";
  300. $resql2=$db->query($sql2);
  301. if ($resql2)
  302. {
  303. $obj2=$db->fetch_object($resql2);
  304. $nbuser=$obj2->nb;
  305. }
  306. else dol_print_error($db);
  307. $opensurvey_static->id=$obj->rowid;
  308. $opensurvey_static->ref=$obj->rowid;
  309. $opensurvey_static->title=$obj->titre;
  310. $opensurvey_static->status=$obj->status;
  311. $opensurvey_static->date_fin=$db->jdate($obj->date_fin);
  312. // Show here line of result
  313. print '<tr class="oddeven">';
  314. // Ref
  315. print '<td>';
  316. print $opensurvey_static->getNomUrl(1);
  317. print '</td>';
  318. // Title
  319. print '<td>'.dol_htmlentities($obj->titre).'</td>';
  320. // Type
  321. print '<td>';
  322. $type=($obj->format=='A')?'classic':'date';
  323. print img_picto('',dol_buildpath('/opensurvey/img/'.($type == 'classic'?'chart-32.png':'calendar-32.png'),1),'width="16"',1);
  324. print ' '.$langs->trans($type=='classic'?"TypeClassic":"TypeDate");
  325. print '</td><td>';
  326. // Author
  327. if ($obj->fk_user_creat) {
  328. $userstatic = new User($db);
  329. $userstatic->id = $obj->fk_user_creat;
  330. $userstatic->firstname = $obj->firstname;
  331. $userstatic->lastname = $obj->lastname;
  332. $userstatic->login = $userstatic->getFullName($langs, 0, -1, 48);
  333. print $userstatic->getLoginUrl(1);
  334. } else {
  335. print dol_htmlentities($obj->nom_admin);
  336. }
  337. print '</td>';
  338. // Nb of voters
  339. print'<td align="right">'.$nbuser.'</td>'."\n";
  340. print '<td align="center">'.dol_print_date($db->jdate($obj->date_fin),'day');
  341. if ($db->jdate($obj->date_fin) < $now && $obj->status == Opensurveysondage::STATUS_VALIDATED) { print img_warning($langs->trans("Expired")); }
  342. print '</td>';
  343. print'<td align="center">'.$opensurvey_static->getLibStatut(5).'</td>'."\n";
  344. // Extra fields
  345. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  346. // Fields from hook
  347. $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
  348. $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
  349. print $hookmanager->resPrint;
  350. // Action column
  351. print '<td class="nowrap" align="center">';
  352. if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  353. {
  354. $selected=0;
  355. if (in_array($obj->rowid, $arrayofselected)) $selected=1;
  356. print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
  357. }
  358. print '</td>';
  359. print '</tr>'."\n";
  360. $i++;
  361. }
  362. // Show total line
  363. if (isset($totalarray['pos']))
  364. {
  365. print '<tr class="liste_total">';
  366. $i=0;
  367. while ($i < $totalarray['nbfield'])
  368. {
  369. $i++;
  370. if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
  371. else
  372. {
  373. if ($i == 1)
  374. {
  375. if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
  376. else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
  377. }
  378. else print '<td></td>';
  379. }
  380. }
  381. print '</tr>';
  382. }
  383. // If no record found
  384. if ($num == 0)
  385. {
  386. $colspan=1;
  387. foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
  388. print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
  389. }
  390. $db->free($resql);
  391. $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
  392. $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
  393. print $hookmanager->resPrint;
  394. print '</table>'."\n";
  395. print '</div>'."\n";
  396. print '</form>'."\n";
  397. if (in_array('builddoc',$arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
  398. {
  399. $hidegeneratedfilelistifempty=1;
  400. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
  401. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  402. $formfile = new FormFile($db);
  403. // Show list of available documents
  404. $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
  405. $urlsource.=str_replace('&amp;','&',$param);
  406. $filedir=$diroutputmassaction;
  407. $genallowed=$user->rights->mymodule->read;
  408. $delallowed=$user->rights->mymodule->create;
  409. print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
  410. }
  411. // End of page
  412. llxFooter();
  413. $db->close();