index.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. if (cfr('DISTRICTS')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. if ($altCfg['DISTRICTS_ENABLED']) {
  5. $districts = new Districts(true);
  6. //new district creation
  7. if (wf_CheckPost(array('newdistrictname'))) {
  8. $districts->createDistrict($_POST['newdistrictname']);
  9. rcms_redirect($districts::URL_ME);
  10. }
  11. //district deletion
  12. if (wf_CheckGet(array('deletedistrict'))) {
  13. $districts->deleteDistrict($_GET['deletedistrict']);
  14. rcms_redirect($districts::URL_ME);
  15. }
  16. //saving district name
  17. if (wf_CheckPost(array('editdistrictid', 'editdistrictname'))) {
  18. $districts->saveDistrictName($_POST['editdistrictid'], $_POST['editdistrictname']);
  19. rcms_redirect($districts::URL_ME);
  20. }
  21. if (!wf_CheckGet(array('editdistrict'))) {
  22. if (!wf_CheckGet(array('viewusers'))) {
  23. //main interface here
  24. show_window(__('Districts'), $districts->renderDistrictsList());
  25. show_window('', $districts->renderDistrictsCreateForm());
  26. } else {
  27. //rendering district users report
  28. if (wf_CheckGet(array('ajax'))) {
  29. $districts->renderDistrictUsersAjaxData($_GET['viewusers']);
  30. }
  31. show_window('', wf_BackLink($districts::URL_ME));
  32. show_window(__('District') . ': ' . $districts->getDistrictName($_GET['viewusers']), $districts->renderDistrictUsersContainer($_GET['viewusers']));
  33. }
  34. } else {
  35. if (wf_CheckGet(array('editdistrict'))) {
  36. //creating new district data
  37. if (wf_CheckPost(array('citysel', 'allchoicesdone'))) {
  38. $districts->catchDistrictDataCreate();
  39. rcms_redirect($districts::URL_ME . '&editdistrict=' . $_GET['editdistrict']);
  40. }
  41. //deleting some data row
  42. if (wf_CheckGet(array('deletedata'))) {
  43. $districts->deleteDistrictData($_GET['deletedata']);
  44. rcms_redirect($districts::URL_ME . '&editdistrict=' . $_GET['editdistrict']);
  45. }
  46. //render create form
  47. show_window('', wf_BackLink($districts::URL_ME));
  48. show_window(__('District') . ': ' . $districts->getDistrictName($_GET['editdistrict']), $districts->renderDistrictDataCreateForm($_GET['editdistrict']));
  49. show_window(__('Places'), $districts->renderDistrictData($_GET['editdistrict']));
  50. }
  51. }
  52. } else {
  53. show_error(__('This module is disabled'));
  54. }
  55. } else {
  56. show_error(__('Access denied'));
  57. }
  58. ?>