index.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. if ($ubillingConfig->getAlterParam('POLLS_ENABLED')) {
  3. if (cfr('POLLS')) {
  4. $polls = new Polls();
  5. //getting polls data
  6. if (wf_CheckGet(array('ajaxavaiblepolls'))) {
  7. $polls->ajaxAvaiblePolls();
  8. }
  9. //show polls control panel
  10. show_window('', $polls->panel());
  11. // show form for create poll
  12. if (wf_CheckGet(array('action'))) {
  13. if (cfr('POLLSCONFIG')) {
  14. // create new poll
  15. if ($_GET['action'] == 'create_poll') {
  16. if (wf_CheckPost(array('createpoll'))) {
  17. show_window('', $polls->controlPoll($_POST['createpoll']));
  18. }
  19. show_window(__('Create poll'), $polls->renderFormPoll());
  20. }
  21. // edit poll
  22. if ($_GET['action'] == 'edit_poll') {
  23. if (wf_CheckPost(array('editpoll'))) {
  24. show_window('', $polls->controlPoll($_POST['editpoll']));
  25. }
  26. show_window(__('Setting up polling'), $polls->renderFormPoll());
  27. }
  28. // create or edit poll options
  29. if ($_GET['action'] == 'polloptions') {
  30. if (wf_CheckPost(array('polloptions'))) {
  31. show_window('', $polls->controlPollOptions($_POST['polloptions']));
  32. }
  33. show_window(__('Setting the answers to the survey'), $polls->renderFormPollOption());
  34. }
  35. // delete poll
  36. if ($_GET['action'] == 'delete_poll') {
  37. $polls->deletePollData();
  38. }
  39. } else {
  40. show_error(__('Access denied'));
  41. }
  42. } elseif (wf_CheckGet(array('show_options'))) {
  43. show_window(__('Preliminary form of voting'), $polls->renderPreviewPollOption());
  44. } else {
  45. show_window(__('Available polls'), $polls->renderAvaiblePolls());
  46. }
  47. } else {
  48. show_error(__('Permission denied'));
  49. }
  50. } else {
  51. show_error(__('This module is disabled'));
  52. }
  53. ?>