index.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
  4. * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.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 htdocs/opensurvey/index.php
  21. * \ingroup opensurvey
  22. * \brief Home page of opensurvey area
  23. */
  24. // Load Dolibarr environment
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  27. require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  28. // Load translation files required by the page
  29. $langs->load("opensurvey");
  30. // Security check
  31. if (!$user->hasRight('opensurvey', 'read')) {
  32. accessforbidden();
  33. }
  34. $hookmanager = new HookManager($db);
  35. // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
  36. $hookmanager->initHooks(array('opensurveyindex'));
  37. /*
  38. * View
  39. */
  40. $nbsondages = 0;
  41. $sql = 'SELECT COUNT(*) as nb';
  42. $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
  43. $sql .= ' WHERE entity IN ('.getEntity('survey').')';
  44. $resql = $db->query($sql);
  45. if ($resql) {
  46. $obj = $db->fetch_object($resql);
  47. $nbsondages = $obj->nb;
  48. } else {
  49. dol_print_error($db, '');
  50. }
  51. $title = $langs->trans("OpenSurveyArea");
  52. llxHeader('', $title);
  53. print load_fiche_titre($title, '', 'poll');
  54. print '<div class="fichecenter"><div class="fichethirdleft">';
  55. print '<div class="div-table-responsive-no-min">';
  56. print '<table class="noborder centpercent">';
  57. print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("OpenSurveyArea").'</td></tr>';
  58. print '<tr class="oddeven">';
  59. print '<td>'.$langs->trans("NbOfSurveys").'</td><td class="right"><a href="list.php">'.$nbsondages.'</a></td>';
  60. print "</tr>";
  61. //print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
  62. //print $total;
  63. //print '</td></tr>';
  64. print '</table>';
  65. print '</div>';
  66. print '</div></div>';
  67. $parameters = array('user' => $user);
  68. $reshook = $hookmanager->executeHooks('dashboardOpenSurvey', $parameters, $object); // Note that $action and $object may have been modified by hook
  69. // End of page
  70. llxFooter();
  71. $db->close();