mysubscriptions.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. An overview with a list of upcoming reservations where
  5. the user has subscribed to (may also be viewable in the agenda)
  6. Later: links to m_item & m_reservation for every item your group (class) owns and
  7. the possibility (links) for adding new items or reservations
  8. */
  9. require_once('rsys.php');
  10. Rsys::protect_script('mysubscriptions');
  11. $tool_name = get_lang('Booking');
  12. /**
  13. * Filter to display the modify-buttons
  14. */
  15. function modify_filter($id){
  16. return ' <a href="mysubscriptions.php?action=delete&amp;reservation_id='.substr($id,0,strpos($id,'-')).'&amp;dummy='.substr($id,strrpos($id,'-')+1).'" title="'.get_lang("DeleteSubscription").'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang("ConfirmDeleteSubscription")))."'".')) return false;"><img alt="" src="../img/delete.gif" /></a>';
  17. }
  18. switch ($_GET['action']) {
  19. case 'delete' :
  20. Rsys :: delete_subscription($_GET['reservation_id'],$_GET['dummy']);
  21. ob_start();
  22. Display :: display_normal_message(Rsys::get_return_msg(get_lang('SubscriptionDeleted'),"mysubscriptions.php",$tool_name),false);
  23. $msg=ob_get_contents();
  24. ob_end_clean();
  25. default :
  26. $NoSearchResults=get_lang('NoReservations');
  27. Display :: display_header($tool_name);
  28. api_display_tool_title($tool_name);
  29. if (api_is_allowed_to_create_course()) {
  30. echo '<div class="actions">';
  31. echo '<div style="float: right;"><a href="reservation.php">'.Display::return_icon('sessions.gif',get_lang('BookingCalendarView')).'&nbsp;'.get_lang('GoToCalendarView').'</a></div>';
  32. echo '<a href="m_item.php?view=list">'.Display::return_icon('cube.png',get_lang('Resources')).'&nbsp;'.get_lang('Resources').'</a>';
  33. echo '&nbsp;&nbsp;<a href="m_reservation.php?view=list">'.Display::return_icon('calendar_day.gif',get_lang('BookingPeriods')).'&nbsp;'.get_lang('BookingPeriods').'</a>';
  34. echo '&nbsp;&nbsp;<a href="m_reservation.php?action=add&view=list">'.Display::return_icon('calendar_add.gif',get_lang('BookIt')).'&nbsp;'.get_lang('BookIt').'</a>';
  35. if (api_is_platform_admin()) {
  36. //echo '&nbsp;&nbsp;<a href="m_category.php">'.Display::return_icon('settings.gif',get_lang('Configuration')).'&nbsp;'.get_lang('Configuration').'</a>';
  37. }
  38. echo '</div><br />';
  39. }
  40. if (isset ($_POST['action'])) {
  41. switch ($_POST['action']) {
  42. case 'delete_subscriptions' :
  43. $ids = $_POST['subscriptions'];
  44. if (count($ids) > 0) {
  45. foreach ($ids as $id)
  46. Rsys :: delete_subscription(substr($id,0,strpos($id,'-')),substr($id,strrpos($id,'-')+1));
  47. }
  48. break;
  49. }
  50. }
  51. $table = new SortableTable('subscription', array('Rsys','get_num_subscriptions'),array('Rsys','get_table_subscriptions'),2);
  52. $table->set_header(0, '', false,array('style'=>'width:10px'));
  53. $table->set_header(1, get_lang('ResourceName'), true);
  54. $table->set_header(2, get_lang('StartDate'), true);
  55. $table->set_header(3, get_lang('EndDate'), true);
  56. $table->set_header(4, get_lang('Accept'), true);
  57. $table->set_header(5, get_lang('Modify'), false,array('style'=>'width:50px;'));
  58. $table->set_column_filter(5, 'modify_filter');
  59. $table->set_form_actions(array ('delete_subscriptions' => get_lang('DeleteSelectedSubscriptions')),'subscriptions');
  60. $table->display();
  61. }
  62. /**
  63. ---------------------------------------------------------------------
  64. */
  65. Display :: display_footer();
  66. ?>