knowledgerecord_list.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. <?php
  2. /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2021 Frédéric France <frederic.france@netlogic.fr>
  4. * Copyright (C) 2023 Anthony Berton <anthony.berton@bb2a.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file knowledgerecord_list.php
  21. * \ingroup knowledgemanagement
  22. * \brief List page for knowledgerecord
  23. */
  24. // Load Dolibarr environment
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  29. require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
  30. // load knowledgemanagement libraries
  31. require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
  32. // for other modules
  33. if (isModEnabled('categorie')) {
  34. require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
  35. }
  36. //dol_include_once('/othermodule/class/otherobject.class.php');
  37. // Load translation files required by the page
  38. $langs->loadLangs(array("knowledgemanagement", "other"));
  39. $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
  40. $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
  41. $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
  42. $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
  43. $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
  44. $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
  45. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordlist'; // To manage different context of search
  46. $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
  47. $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
  48. $mode = GETPOST('mode', 'aZ09');
  49. $id = GETPOST('id', 'int');
  50. $searchCategoryKnowledgemanagementList = GETPOST('search_category_knowledgemanagement_list', 'array');
  51. $searchCategoryKnowledgemanagementOperator = 0;
  52. if (GETPOSTISSET('formfilteraction')) {
  53. $searchCategoryKnowledgemanagementOperator = GETPOST('search_category_knowledgemanagement_operator', 'int');
  54. } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
  55. $searchCategoryKnowledgemanagementOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
  56. }
  57. // Load variable for pagination
  58. $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
  59. $sortfield = GETPOST('sortfield', 'aZ09comma');
  60. $sortorder = GETPOST('sortorder', 'aZ09comma');
  61. $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
  62. if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  63. // If $page is not defined, or '' or -1 or if we click on clear filters
  64. $page = 0;
  65. }
  66. $offset = $limit * $page;
  67. $pageprev = $page - 1;
  68. $pagenext = $page + 1;
  69. // Initialize technical objects
  70. $object = new KnowledgeRecord($db);
  71. $extrafields = new ExtraFields($db);
  72. $diroutputmassaction = $conf->knowledgemanagement->dir_output.'/temp/massgeneration/'.$user->id;
  73. $hookmanager->initHooks(array('knowledgerecordlist')); // Note that conf->hooks_modules contains array
  74. // Fetch optionals attributes and labels
  75. $extrafields->fetch_name_optionals_label($object->table_element);
  76. //$extrafields->fetch_name_optionals_label($object->table_element_line);
  77. $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
  78. // Default sort order (if not yet defined by previous GETPOST)
  79. if (!$sortfield) {
  80. reset($object->fields); // Reset is required to avoid key() to return null.
  81. $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
  82. }
  83. if (!$sortorder) {
  84. $sortorder = "ASC";
  85. }
  86. // Initialize array of search criterias
  87. $search_all = GETPOST('search_all', 'alphanohtml');
  88. $search = array();
  89. foreach ($object->fields as $key => $val) {
  90. if ($key == "lang") {
  91. $search[$key] = GETPOST('search_'.$key, 'alpha')!='0' ? GETPOST('search_'.$key, 'alpha') : '';
  92. } else {
  93. $search[$key] = GETPOST('search_'.$key, 'alpha');
  94. }
  95. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  96. $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
  97. $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
  98. }
  99. }
  100. // List of fields to search into when doing a "search in all"
  101. $fieldstosearchall = array();
  102. foreach ($object->fields as $key => $val) {
  103. if (!empty($val['searchall'])) {
  104. $fieldstosearchall['t.'.$key] = $val['label'];
  105. }
  106. }
  107. // Definition of array of fields for columns
  108. $arrayfields = array();
  109. foreach ($object->fields as $key => $val) {
  110. // If $val['visible']==0, then we never show the field
  111. if (!empty($val['visible'])) {
  112. $visible = (int) dol_eval($val['visible'], 1);
  113. $arrayfields['t.'.$key] = array(
  114. 'label'=>$val['label'],
  115. 'checked'=>(($visible < 0) ? 0 : 1),
  116. 'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
  117. 'position'=>$val['position'],
  118. 'help'=> isset($val['help']) ? $val['help'] : ''
  119. );
  120. }
  121. }
  122. // Extra fields
  123. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
  124. $object->fields = dol_sort_array($object->fields, 'position');
  125. $arrayfields = dol_sort_array($arrayfields, 'position');
  126. $permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read');
  127. $permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write');
  128. $permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete');
  129. // Security check
  130. if (empty($conf->knowledgemanagement->enabled)) {
  131. accessforbidden('Module not enabled');
  132. }
  133. $socid = 0;
  134. if ($user->socid > 0) { // Protection if external user
  135. //$socid = $user->socid;
  136. accessforbidden();
  137. }
  138. $result = restrictedArea($user, 'knowledgemanagement', 0, '', 'knowledgerecord');
  139. //if (!$permissiontoread) accessforbidden();
  140. /*
  141. * Actions
  142. */
  143. if (GETPOST('cancel', 'alpha')) {
  144. $action = 'list';
  145. $massaction = '';
  146. }
  147. if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
  148. $massaction = '';
  149. }
  150. $parameters = array();
  151. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  152. if ($reshook < 0) {
  153. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  154. }
  155. if (empty($reshook)) {
  156. // Selection of new fields
  157. include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
  158. // Purge search criteria
  159. 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
  160. foreach ($object->fields as $key => $val) {
  161. $search[$key] = '';
  162. if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  163. $search[$key.'_dtstart'] = '';
  164. $search[$key.'_dtend'] = '';
  165. }
  166. }
  167. $toselect = array();
  168. $search_array_options = array();
  169. }
  170. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
  171. || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
  172. $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
  173. }
  174. if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
  175. $searchCategoryKnowledgemanagementOperator = 0;
  176. $searchCategoryKnowledgemanagementList = array();
  177. }
  178. // Mass actions
  179. $objectclass = 'KnowledgeRecord';
  180. $objectlabel = 'KnowledgeRecord';
  181. $uploaddir = $conf->knowledgemanagement->dir_output;
  182. include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
  183. }
  184. /*
  185. * View
  186. */
  187. $form = new Form($db);
  188. $user_temp = new User($db);
  189. $formadmin = new FormAdmin($db);
  190. $now = dol_now();
  191. //$help_url="EN:Module_KnowledgeRecord|FR:Module_KnowledgeRecord_FR|ES:Módulo_KnowledgeRecord";
  192. $help_url = '';
  193. $title = $langs->trans('KnowledgeRecords');
  194. $morejs = array();
  195. $morecss = array();
  196. // Build and execute select
  197. // --------------------------------------------------------------------
  198. $sql = 'SELECT ';
  199. $sql .= $object->getFieldList('t');
  200. // Add fields from extrafields
  201. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  202. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
  203. $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
  204. }
  205. }
  206. // Add fields from hooks
  207. $parameters = array();
  208. $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
  209. $sql .= $hookmanager->resPrint;
  210. $sql = preg_replace('/,\s*$/', '', $sql);
  211. $sqlfields = $sql; // $sql fields to remove for count total
  212. $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
  213. if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
  214. $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
  215. }
  216. // Add table from hooks
  217. $parameters = array();
  218. $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
  219. $sql .= $hookmanager->resPrint;
  220. if ($object->ismultientitymanaged == 1) {
  221. $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
  222. } else {
  223. $sql .= " WHERE 1 = 1";
  224. }
  225. foreach ($search as $key => $val) {
  226. if (array_key_exists($key, $object->fields)) {
  227. if ($key == 'status' && $search[$key] == -1) {
  228. continue;
  229. }
  230. $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
  231. if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
  232. if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
  233. $search[$key] = '';
  234. }
  235. $mode_search = 2;
  236. }
  237. if ($search[$key] != '') {
  238. $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
  239. }
  240. } else {
  241. if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
  242. $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
  243. if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
  244. if (preg_match('/_dtstart$/', $key)) {
  245. $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
  246. }
  247. if (preg_match('/_dtend$/', $key)) {
  248. $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
  249. }
  250. }
  251. }
  252. }
  253. }
  254. // Search for tag/category ($searchCategoryKnowledgemanagementList is an array of ID)
  255. if (!empty($searchCategoryKnowledgemanagementList)) {
  256. $searchCategoryKnowledgemanagementSqlList = array();
  257. $listofcategoryid = '';
  258. foreach ($searchCategoryKnowledgemanagementList as $searchCategoryKnowledgemanagement) {
  259. if (intval($searchCategoryKnowledgemanagement) == -2) {
  260. $searchCategoryKnowledgemanagementSqlList[] = "NOT EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement)";
  261. } elseif (intval($searchCategoryKnowledgemanagement) > 0) {
  262. if (empty($searchCategoryKnowledgemanagementOperator)) {
  263. $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie = ".((int) $searchCategoryKnowledgemanagement).")";
  264. } else {
  265. $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryKnowledgemanagement);
  266. }
  267. }
  268. }
  269. if ($listofcategoryid) {
  270. $searchCategoryKnowledgemanagementSqlList[] = " EXISTS (SELECT ck.fk_knowledgemanagement FROM ".MAIN_DB_PREFIX."categorie_knowledgemanagement as ck WHERE t.rowid = ck.fk_knowledgemanagement AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
  271. }
  272. if ($searchCategoryKnowledgemanagementOperator == 1) {
  273. if (!empty($searchCategoryKnowledgemanagementSqlList)) {
  274. $sql .= " AND (".implode(' OR ', $searchCategoryKnowledgemanagementSqlList).")";
  275. }
  276. } else {
  277. if (!empty($searchCategoryKnowledgemanagementSqlList)) {
  278. $sql .= " AND (".implode(' AND ', $searchCategoryKnowledgemanagementSqlList).")";
  279. }
  280. }
  281. }
  282. if ($search_all) {
  283. $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
  284. }
  285. //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
  286. // Add where from extra fields
  287. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
  288. // Add where from hooks
  289. $parameters = array();
  290. $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  291. $sql .= $hookmanager->resPrint;
  292. /* If a group by is required
  293. $sql.= " GROUP BY ";
  294. foreach($object->fields as $key => $val) {
  295. $sql .= "t.".$key.", ";
  296. }
  297. // Add fields from extrafields
  298. if (!empty($extrafields->attributes[$object->table_element]['label'])) {
  299. foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
  300. }
  301. // Add where from hooks
  302. $parameters=array();
  303. $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
  304. $sql.=$hookmanager->resPrint;
  305. $sql=preg_replace('/,\s*$/','', $sql);
  306. */
  307. // Count total nb of records
  308. $nbtotalofrecords = '';
  309. if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
  310. /* The fast and low memory method to get and count full list converts the sql into a sql count */
  311. $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
  312. $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
  313. $resql = $db->query($sqlforcount);
  314. if ($resql) {
  315. $objforcount = $db->fetch_object($resql);
  316. $nbtotalofrecords = $objforcount->nbtotalofrecords;
  317. } else {
  318. dol_print_error($db);
  319. }
  320. if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
  321. $page = 0;
  322. $offset = 0;
  323. }
  324. $db->free($resql);
  325. }
  326. // Complete request and execute it with limit
  327. $sql .= $db->order($sortfield, $sortorder);
  328. if ($limit) {
  329. $sql .= $db->plimit($limit + 1, $offset);
  330. }
  331. $resql = $db->query($sql);
  332. if (!$resql) {
  333. dol_print_error($db);
  334. exit;
  335. }
  336. $num = $db->num_rows($resql);
  337. // Direct jump if only one record found
  338. if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
  339. $obj = $db->fetch_object($resql);
  340. $id = $obj->rowid;
  341. header("Location: ".dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$id);
  342. exit;
  343. }
  344. // Output page
  345. // --------------------------------------------------------------------
  346. llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
  347. $arrayofselected = is_array($toselect) ? $toselect : array();
  348. $param = '';
  349. if (!empty($mode)) {
  350. $param .= '&mode='.urlencode($mode);
  351. }
  352. if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
  353. $param .= '&contextpage='.urlencode($contextpage);
  354. }
  355. if ($limit > 0 && $limit != $conf->liste_limit) {
  356. $param .= '&limit='.((int) $limit);
  357. }
  358. foreach ($search as $key => $val) {
  359. if (is_array($search[$key])) {
  360. foreach ($search[$key] as $skey) {
  361. if ($skey != '') {
  362. $param .= '&search_'.$key.'[]='.urlencode($skey);
  363. }
  364. }
  365. } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
  366. $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
  367. $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
  368. $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
  369. } elseif ($search[$key] != '') {
  370. $param .= '&search_'.$key.'='.urlencode($search[$key]);
  371. }
  372. }
  373. if ($optioncss != '') {
  374. $param .= '&optioncss='.urlencode($optioncss);
  375. }
  376. // Add $param from extra fields
  377. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
  378. // Add $param from hooks
  379. $parameters = array();
  380. $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
  381. $param .= $hookmanager->resPrint;
  382. // List of mass actions available
  383. $arrayofmassactions = array(
  384. 'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
  385. //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
  386. //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
  387. //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
  388. );
  389. if (isModEnabled('category') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) {
  390. $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
  391. }
  392. if (!empty($permissiontodelete)) {
  393. $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
  394. }
  395. if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
  396. $arrayofmassactions = array();
  397. }
  398. $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
  399. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
  400. if ($optioncss != '') {
  401. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  402. }
  403. print '<input type="hidden" name="token" value="'.newToken().'">';
  404. print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
  405. print '<input type="hidden" name="action" value="list">';
  406. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  407. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  408. print '<input type="hidden" name="page" value="'.$page.'">';
  409. print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
  410. print '<input type="hidden" name="page_y" value="">';
  411. print '<input type="hidden" name="mode" value="'.$mode.'">';
  412. $newcardbutton = '';
  413. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
  414. $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
  415. $newcardbutton .= dolGetButtonTitleSeparator();
  416. $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
  417. print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
  418. // Add code for pre mass action (confirmation or email presend form)
  419. $topicmail = "SendKnowledgeRecordRef";
  420. $modelmail = "knowledgerecord";
  421. $objecttmp = new KnowledgeRecord($db);
  422. $trackid = 'xxxx'.$object->id;
  423. include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
  424. if ($search_all) {
  425. $setupstring = '';
  426. foreach ($fieldstosearchall as $key => $val) {
  427. $fieldstosearchall[$key] = $langs->trans($val);
  428. $setupstring .= $key."=".$val.";";
  429. }
  430. print '<!-- Search done like if KNOWLEDGEMANAGEMENT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
  431. print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
  432. }
  433. $moreforfilter = '';
  434. /*$moreforfilter.='<div class="divsearchfield">';
  435. $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
  436. $moreforfilter.= '</div>';*/
  437. // Filter on categories
  438. $moreforfilter = '';
  439. if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
  440. $moreforfilter .= '<div class="divsearchfield">';
  441. $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
  442. $categoriesKnowledgeArr = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', '', 64, 0, 1);
  443. $categoriesKnowledgeArr[-2] = '- '.$langs->trans('NotCategorized').' -';
  444. $moreforfilter .= Form::multiselectarray('search_category_knowledgemanagement_list', $categoriesKnowledgeArr, $searchCategoryKnowledgemanagementList, 0, 0, 'minwidth300');
  445. $moreforfilter .= ' <input type="checkbox" class="valignmiddle" id="search_category_knowledgemanagement_operator" name="search_category_knowledgemanagement_operator" value="1"'.($searchCategoryKnowledgemanagementOperator == 1 ? ' checked="checked"' : '').'/><label class="none valignmiddle" for="search_category_knowledgemanagement_operator">'.$langs->trans('UseOrOperatorForCategories').'</label>';
  446. $moreforfilter .= '</div>';
  447. }
  448. $parameters = array();
  449. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  450. if (empty($reshook)) {
  451. $moreforfilter .= $hookmanager->resPrint;
  452. } else {
  453. $moreforfilter = $hookmanager->resPrint;
  454. }
  455. if (!empty($moreforfilter)) {
  456. print '<div class="liste_titre liste_titre_bydiv centpercent">';
  457. print $moreforfilter;
  458. $parameters = array('type'=>$type);
  459. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  460. print $hookmanager->resPrint;
  461. print '</div>';
  462. }
  463. $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
  464. $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
  465. $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
  466. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  467. print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
  468. // Fields title search
  469. // --------------------------------------------------------------------
  470. print '<tr class="liste_titre_filter">';
  471. // Action column
  472. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  473. print '<td class="liste_titre maxwidthsearch center">';
  474. $searchpicto = $form->showFilterButtons('left');
  475. print $searchpicto;
  476. print '</td>';
  477. }
  478. foreach ($object->fields as $key => $val) {
  479. $searchkey = empty($search[$key]) ? '' : $search[$key];
  480. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  481. if ($key == 'status') {
  482. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  483. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  484. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  485. } elseif (in_array($val['type'], array('timestamp'))) {
  486. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  487. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  488. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  489. }
  490. if (!empty($arrayfields['t.'.$key]['checked'])) {
  491. print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').($key == 'status' ? ' parentonrightofpage' : '').'">';
  492. if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
  493. print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1);
  494. } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
  495. print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
  496. } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
  497. print '<div class="nowrap">';
  498. print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
  499. print '</div>';
  500. print '<div class="nowrap">';
  501. print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
  502. print '</div>';
  503. } elseif ($key == 'lang') {
  504. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  505. $formadmin = new FormAdmin($db);
  506. print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
  507. } else {
  508. print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
  509. }
  510. print '</td>';
  511. }
  512. }
  513. // Extra fields
  514. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
  515. // Fields from hook
  516. $parameters = array('arrayfields'=>$arrayfields);
  517. $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  518. print $hookmanager->resPrint;
  519. // Action column
  520. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  521. print '<td class="liste_titre center maxwidthsearch">';
  522. $searchpicto = $form->showFilterButtons();
  523. print $searchpicto;
  524. print '</td>';
  525. }
  526. print '</tr>'."\n";
  527. $totalarray = array();
  528. $totalarray['nbfield'] = 0;
  529. // Fields title label
  530. // --------------------------------------------------------------------
  531. print '<tr class="liste_titre">';
  532. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  533. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
  534. $totalarray['nbfield']++;
  535. }
  536. foreach ($object->fields as $key => $val) {
  537. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  538. if ($key == 'status') {
  539. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  540. } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  541. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  542. } elseif (in_array($val['type'], array('timestamp'))) {
  543. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  544. } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
  545. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  546. }
  547. $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
  548. if (!empty($arrayfields['t.'.$key]['checked'])) {
  549. print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
  550. $totalarray['nbfield']++;
  551. }
  552. }
  553. // Extra fields
  554. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
  555. // Hook fields
  556. $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
  557. $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  558. print $hookmanager->resPrint;
  559. // Action column
  560. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  561. print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
  562. $totalarray['nbfield']++;
  563. }
  564. print '</tr>'."\n";
  565. // Detect if we need a fetch on each output line
  566. $needToFetchEachLine = 0;
  567. if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
  568. foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
  569. if ($val && preg_match('/\$object/', $val)) {
  570. $needToFetchEachLine++; // There is at least one compute field that use $object
  571. }
  572. }
  573. }
  574. // Loop on record
  575. // --------------------------------------------------------------------
  576. $i = 0;
  577. $savnbfield = $totalarray['nbfield'];
  578. $totalarray = array();
  579. $totalarray['nbfield'] = 0;
  580. $imaxinloop = ($limit ? min($num, $limit) : $num);
  581. while ($i < $imaxinloop) {
  582. $obj = $db->fetch_object($resql);
  583. if (empty($obj)) {
  584. break; // Should not happen
  585. }
  586. // Store properties in $object
  587. $object->setVarsFromFetchObj($obj);
  588. if ($mode == 'kanban') {
  589. if ($i == 0) {
  590. print '<tr><td colspan="'.$savnbfield.'">';
  591. print '<div class="box-flex-container kanban">';
  592. }
  593. // Output Kanban
  594. print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
  595. if ($i == ($imaxinloop - 1)) {
  596. print '</div>';
  597. print '</td></tr>';
  598. }
  599. } else {
  600. // Show here line of result
  601. $j = 0;
  602. print '<tr data-rowid="'.$object->id.'" class="oddeven">';
  603. // Action column
  604. if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  605. print '<td class="nowrap center">';
  606. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  607. $selected = 0;
  608. if (in_array($object->id, $arrayofselected)) {
  609. $selected = 1;
  610. }
  611. print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  612. }
  613. print '</td>';
  614. if (!$i) {
  615. $totalarray['nbfield']++;
  616. }
  617. }
  618. foreach ($object->fields as $key => $val) {
  619. $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
  620. if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
  621. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  622. } elseif ($key == 'status') {
  623. $cssforfield .= ($cssforfield ? ' ' : '').'center';
  624. }
  625. if (in_array($val['type'], array('timestamp'))) {
  626. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  627. } elseif ($key == 'ref') {
  628. $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
  629. }
  630. if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
  631. $cssforfield .= ($cssforfield ? ' ' : '').'right';
  632. }
  633. //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
  634. if (!empty($arrayfields['t.'.$key]['checked'])) {
  635. print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
  636. if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
  637. print ' title="'.dol_escape_htmltag(dol_nl2br($object->$key, 1)).'"'; // We add dol_nl2br for the question and answer fields
  638. }
  639. print '>';
  640. if ($key == 'status') {
  641. print $object->getLibStatut(5);
  642. } elseif ($key == 'rowid') {
  643. print $object->showOutputField($val, $key, $object->id, '');
  644. } elseif ($key == 'fk_user_creat') {
  645. if ($object->fk_user_creat > 0) {
  646. if (isset($conf->cache['user'][$object->fk_user_creat])) {
  647. $user_temp = $conf->cache['user'][$object->fk_user_creat];
  648. } else {
  649. $user_temp = new User($db);
  650. $user_temp->fetch($object->fk_user_creat);
  651. $conf->cache['user'][$object->fk_user_creat] = $user_temp;
  652. }
  653. print $user_temp->getNomUrl(-1);
  654. }
  655. } elseif ($key == 'fk_user_modif') {
  656. if ($object->fk_user_modif > 0) {
  657. if (isset($conf->cache['user'][$object->fk_user_modif])) {
  658. $user_temp = $conf->cache['user'][$object->fk_user_modif];
  659. } else {
  660. $user_temp = new User($db);
  661. $user_temp->fetch($object->fk_user_modif);
  662. $conf->cache['user'][$object->fk_user_modif] = $user_temp;
  663. }
  664. print $user_temp->getNomUrl(-1);
  665. }
  666. } elseif ($key == 'fk_user_valid') {
  667. if ($object->fk_user_valid > 0) {
  668. if (isset($conf->cache['user'][$object->fk_user_valid])) {
  669. $user_temp = $conf->cache['user'][$object->fk_user_valid];
  670. } else {
  671. $user_temp = new User($db);
  672. $user_temp->fetch($object->fk_user_valid);
  673. $conf->cache['user'][$object->fk_user_valid] = $user_temp;
  674. }
  675. print $user_temp->getNomUrl(-1);
  676. }
  677. } elseif ($key == 'lang') {
  678. $labellang = ($object->lang ? $langs->trans('Language_'.$object->lang) : '');
  679. print picto_from_langcode($object->lang, 'class="paddingrightonly saturatemedium opacitylow"');
  680. print $labellang;
  681. } elseif ($key == 'question') {
  682. print dolGetFirstLineOfText($object->$key);
  683. } else {
  684. print $object->showOutputField($val, $key, $object->$key, '');
  685. }
  686. print '</td>';
  687. if (!$i) {
  688. $totalarray['nbfield']++;
  689. }
  690. if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
  691. if (!$i) {
  692. $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
  693. }
  694. if (!isset($totalarray['val'])) {
  695. $totalarray['val'] = array();
  696. }
  697. if (!isset($totalarray['val']['t.'.$key])) {
  698. $totalarray['val']['t.'.$key] = 0;
  699. }
  700. $totalarray['val']['t.'.$key] += $object->$key;
  701. }
  702. }
  703. }
  704. // Extra fields
  705. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
  706. // Fields from hook
  707. $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
  708. $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  709. print $hookmanager->resPrint;
  710. // Action column
  711. if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
  712. print '<td class="nowrap center">';
  713. if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
  714. $selected = 0;
  715. if (in_array($object->id, $arrayofselected)) {
  716. $selected = 1;
  717. }
  718. print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
  719. }
  720. print '</td>';
  721. if (!$i) {
  722. $totalarray['nbfield']++;
  723. }
  724. }
  725. print '</tr>'."\n";
  726. }
  727. $i++;
  728. }
  729. // Show total line
  730. include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
  731. // If no record found
  732. if ($num == 0) {
  733. $colspan = 1;
  734. foreach ($arrayfields as $key => $val) {
  735. if (!empty($val['checked'])) {
  736. $colspan++;
  737. }
  738. }
  739. print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
  740. }
  741. $db->free($resql);
  742. $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
  743. $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
  744. print $hookmanager->resPrint;
  745. print '</table>'."\n";
  746. print '</div>'."\n";
  747. print '</form>'."\n";
  748. if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
  749. $hidegeneratedfilelistifempty = 1;
  750. if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
  751. $hidegeneratedfilelistifempty = 0;
  752. }
  753. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
  754. $formfile = new FormFile($db);
  755. // Show list of available documents
  756. $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
  757. $urlsource .= str_replace('&amp;', '&', $param);
  758. $filedir = $diroutputmassaction;
  759. $genallowed = $permissiontoread;
  760. $delallowed = $permissiontoadd;
  761. print $formfile->showdocuments('massfilesarea_knowledgemanagement', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
  762. }
  763. // End of page
  764. llxFooter();
  765. $db->close();