index.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. require '../main.inc.php';
  25. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  26. require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
  27. // Load translation files required by the page
  28. $langs->load("opensurvey");
  29. // Security check
  30. if (empty($user->rights->opensurvey->read)) {
  31. accessforbidden();
  32. }
  33. $hookmanager = new HookManager($db);
  34. // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
  35. $hookmanager->initHooks(array('opensurveyindex'));
  36. /*
  37. * View
  38. */
  39. $nbsondages = 0;
  40. $sql = 'SELECT COUNT(*) as nb';
  41. $sql .= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
  42. $sql .= ' WHERE entity IN ('.getEntity('survey').')';
  43. $resql = $db->query($sql);
  44. if ($resql) {
  45. $obj = $db->fetch_object($resql);
  46. $nbsondages = $obj->nb;
  47. } else {
  48. dol_print_error($db, '');
  49. }
  50. $title = $langs->trans("OpenSurveyArea");
  51. llxHeader('', $title);
  52. print load_fiche_titre($title, '', 'poll');
  53. print '<div class="fichecenter"><div class="fichethirdleft">';
  54. print '<div class="div-table-responsive-no-min">';
  55. print '<table class="noborder centpercent">';
  56. print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("OpenSurveyArea").'</td></tr>';
  57. print '<tr class="oddeven">';
  58. print '<td>'.$langs->trans("NbOfSurveys").'</td><td class="right"><a href="list.php">'.$nbsondages.'</a></td>';
  59. print "</tr>";
  60. //print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
  61. //print $total;
  62. //print '</td></tr>';
  63. print '</table>';
  64. print '</div>';
  65. print '</div></div>';
  66. $parameters = array('user' => $user);
  67. $reshook = $hookmanager->executeHooks('dashboardOpenSurvey', $parameters, $object); // Note that $action and $object may have been modified by hook
  68. // End of page
  69. llxFooter();
  70. $db->close();