index.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. if (cfr('CAPAB')) {
  3. $altercfg = $ubillingConfig->getAlter();
  4. if ($altercfg['CAPABDIR_ENABLED']) {
  5. $capabilities = new CapabilitiesDirectory();
  6. //process deletion
  7. if (wf_CheckGet(array('delete'))) {
  8. if (cfr('ROOT')) {
  9. $capabilities->deleteCapability($_GET['delete']);
  10. rcms_redirect("?module=capabilities");
  11. } else {
  12. show_error(__('Permission denied'));
  13. }
  14. }
  15. //process creation
  16. if (wf_CheckPost(array('newaddress', 'newphone'))) {
  17. $newaddress = $_POST['newaddress'];
  18. $newphone = $_POST['newphone'];
  19. @$newnotes = $_POST['newnotes'];
  20. $capabilities->addCapability($newaddress, $newphone, $newnotes);
  21. rcms_redirect("?module=capabilities");
  22. }
  23. //show editing form
  24. if (wf_CheckGet(array('edit'))) {
  25. $capabId = ubRouting::get('edit', 'int');
  26. //editing processing
  27. if (wf_CheckPost(array('editaddress', 'editphone'))) {
  28. $capabilities->editCapability($capabId, $_POST['editaddress'], $_POST['editphone'], $_POST['editstateid'], @$_POST['editnotes'], @$_POST['editprice'], $_POST['editemployeeid']);
  29. rcms_redirect("?module=capabilities");
  30. }
  31. show_window(__('Edit'), $capabilities->editForm($capabId));
  32. //some source marks here
  33. $capabSource = new Stigma('CAPABSOURCE');
  34. $capabSource->stigmaController('SYSTEM:SOURCE');
  35. show_window(__('Capabylity source'), $capabSource->render($capabId));
  36. }
  37. //show current states editor
  38. if (wf_CheckGet(array('states'))) {
  39. //creating new state
  40. if (wf_CheckPost(array('createstate', 'createstatecolor'))) {
  41. $capabilities->statesCreate($_POST['createstate'], $_POST['createstatecolor']);
  42. rcms_redirect("?module=capabilities&states=true");
  43. }
  44. //deleting existing state
  45. if (wf_CheckGet(array('deletestate'))) {
  46. $capabilities->statesDelete($_GET['deletestate']);
  47. rcms_redirect("?module=capabilities&states=true");
  48. }
  49. if (!wf_CheckGet(array('editstate'))) {
  50. show_window(__('Create new states'), $capabilities->statesAddForm());
  51. show_window(__('Available states'), $capabilities->statesList());
  52. } else {
  53. //editing of existing states
  54. if (wf_CheckPost(array('editstate', 'editstatecolor'))) {
  55. $capabilities->statesChange($_GET['editstate'], $_POST['editstate'], $_POST['editstatecolor']);
  56. rcms_redirect("?module=capabilities&states=true");
  57. }
  58. show_window(__('Edit'), $capabilities->statesEditForm($_GET['editstate']));
  59. }
  60. }
  61. //show available
  62. if (!wf_CheckGet(array('edit'))) {
  63. if (!wf_CheckGet(array('stats'))) {
  64. if (!wf_CheckGet(array('states'))) {
  65. if (wf_CheckGet(array('ajlist'))) {
  66. die($capabilities->ajCapabList());
  67. }
  68. if (wf_CheckGet(array('calendar'))) {
  69. show_window(__('Available connection capabilities'), $capabilities->renderCalendar());
  70. } else {
  71. show_window(__('Available connection capabilities'), $capabilities->render());
  72. }
  73. }
  74. } else {
  75. //some stats here
  76. show_window('', wf_BackLink($capabilities::URL_ME));
  77. show_window(__('Capabylity source'), $capabilities->renderSourcesStats());
  78. show_window(__('Available states'), $capabilities->renderStatesStats());
  79. }
  80. }
  81. } else {
  82. show_error(__('This module is disabled'));
  83. }
  84. } else {
  85. show_error(__('You cant control this module'));
  86. }