index.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. if (cfr('STICKYNOTES')) {
  3. $altCfg = $ubillingConfig->getAlter();
  4. if ($altCfg['STICKY_NOTES_ENABLED']) {
  5. //creating main object
  6. $stickyNotes = new StickyNotes(false);
  7. //control panel display
  8. show_window('', $stickyNotes->panel());
  9. //sticky notes management
  10. if (!ubRouting::checkGet($stickyNotes::ROUTE_REVELATIONS)) {
  11. //custom return URLs?
  12. $backUrl = '';
  13. if (ubRouting::get($stickyNotes::ROUTE_BACK) == 'calendar') {
  14. $backUrl .= '&' . $stickyNotes::ROUTE_CALENDAR . '=true';
  15. }
  16. // new note creation
  17. if (ubRouting::checkPost($stickyNotes::PROUTE_NEW_NOTE)) {
  18. $stickyNotes->addMyNote();
  19. ubRouting::nav($stickyNotes::URL_ME . $backUrl);
  20. }
  21. //note deletion
  22. if (ubRouting::checkGet($stickyNotes::ROUTE_DEL_NOTE)) {
  23. $stickyNotes->deleteNote(ubRouting::get($stickyNotes::ROUTE_DEL_NOTE));
  24. ubRouting::nav($stickyNotes::URL_ME . $backUrl);
  25. }
  26. //note editing
  27. if (ubRouting::checkPost(array($stickyNotes::PROUTE_EDIT_NOTE_TEXT, $stickyNotes::PROUTE_EDIT_NOTE_ID))) {
  28. $stickyNotes->saveMyNote();
  29. ubRouting::nav($stickyNotes::URL_ME . $backUrl);
  30. }
  31. if ((!ubRouting::checkGet($stickyNotes::ROUTE_SHOW_NOTE)) AND (!ubRouting::checkGet($stickyNotes::ROUTE_EDIT_FORM))) {
  32. //grid or calendar view switch
  33. if (!ubRouting::checkGet($stickyNotes::ROUTE_CALENDAR)) {
  34. show_window(__('Available personal notes'), $stickyNotes->renderListGrid());
  35. } else {
  36. show_window(__('Available personal notes'), $stickyNotes->renderListCalendar());
  37. }
  38. } else {
  39. //rendering full note content
  40. if (ubRouting::checkGet($stickyNotes::ROUTE_SHOW_NOTE)) {
  41. $noteData = $stickyNotes->getNoteData(ubRouting::get($stickyNotes::ROUTE_SHOW_NOTE));
  42. $noteParams = '';
  43. if (!empty($noteData[$stickyNotes::PROUTE_REMIND_DATE])) {
  44. $noteParams .= ' / ' . __('Remind time') . ': ' . $noteData[$stickyNotes::PROUTE_REMIND_DATE];
  45. }
  46. if (!empty($noteData[$stickyNotes::PROUTE_REMIND_TIME])) {
  47. $noteParams .= ' ' . $noteData[$stickyNotes::PROUTE_REMIND_TIME];
  48. }
  49. show_window(__('Sticky note') . $noteParams, $stickyNotes->renderNote(ubRouting::get($stickyNotes::ROUTE_SHOW_NOTE)));
  50. }
  51. //note editing interface
  52. if (ubRouting::checkGet($stickyNotes::ROUTE_EDIT_FORM)) {
  53. $editNoteId = ubRouting::get($stickyNotes::ROUTE_EDIT_FORM, 'int');
  54. show_window(__('Edit'), $stickyNotes->editForm($editNoteId, true));
  55. //some controls here
  56. show_window('', wf_BackLink($stickyNotes::URL_ME) . ' ' . $stickyNotes->getEditFormDeleteControls($editNoteId));
  57. }
  58. }
  59. } else {
  60. //revelations management
  61. if (cfr('REVELATIONS')) {
  62. //new revelation creation
  63. if (ubRouting::checkPost($stickyNotes::PROUTE_NEW_REVELATION)) {
  64. $stickyNotes->addMyRevelation();
  65. ubRouting::nav($stickyNotes::URL_REVELATIONS);
  66. }
  67. //revelation deletion
  68. if (ubRouting::checkGet($stickyNotes::ROUTE_DEL_REV)) {
  69. $stickyNotes->deleteRevelation(ubRouting::get($stickyNotes::ROUTE_DEL_REV));
  70. ubRouting::nav($stickyNotes::URL_REVELATIONS);
  71. }
  72. //revelation editing
  73. if (ubRouting::checkPost(array($stickyNotes::PROUTE_EDIT_REV_TEXT, $stickyNotes::PROUTE_EDIT_REV_ID))) {
  74. $stickyNotes->saveMyRevelation();
  75. ubRouting::nav($stickyNotes::URL_REVELATIONS);
  76. }
  77. }
  78. if (ubRouting::checkGet(array('editrev'))) {
  79. show_window(__('Edit'), $stickyNotes->revelationEditForm(ubRouting::get($stickyNotes::ROUTE_EDIT_REV_FORM)));
  80. } else {
  81. //rendering existing list
  82. show_window(__('Revelations'), $stickyNotes->renderRevelationsList());
  83. }
  84. }
  85. } else {
  86. show_window(__('Error'), __('This module is disabled'));
  87. }
  88. } else {
  89. show_error(__('Access denied'));
  90. }