mysubscriptions.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php // $Id: mysubscriptions.php,v 1.3 2006/04/27 14:14:03 kvansteenkiste Exp $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos S.
  6. Copyright (c) Sebastien Jacobs (www.spiritual-coder.com)
  7. Copyright (c) Kristof Van Steenkiste
  8. Copyright (c) Julio Montoya Armas
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. ---------------------------------------------------------------------
  22. An overview with a list of upcoming reservations where
  23. the user has subscribed to (may also be viewable in the agenda)
  24. Later: links to m_item & m_reservation for every item your group (class) owns and
  25. the possibility (links) for adding new items or reservations
  26. ---------------------------------------------------------------------
  27. */
  28. require_once('rsys.php');
  29. Rsys::protect_script('mysubscriptions');
  30. $tool_name = get_lang('Booking');
  31. /**
  32. ---------------------------------------------------------------------
  33. */
  34. /**
  35. * Filter to display the modify-buttons
  36. */
  37. function modify_filter($id){
  38. 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>';
  39. }
  40. /**
  41. ---------------------------------------------------------------------
  42. */
  43. switch ($_GET['action']) {
  44. case 'delete' :
  45. Rsys :: delete_subscription($_GET['reservation_id'],$_GET['dummy']);
  46. ob_start();
  47. Display :: display_normal_message(Rsys::get_return_msg(get_lang('SubscriptionDeleted'),"mysubscriptions.php",$tool_name),false);
  48. $msg=ob_get_contents();
  49. ob_end_clean();
  50. default :
  51. $NoSearchResults=get_lang('NoReservations');
  52. Display :: display_header($tool_name);
  53. api_display_tool_title($tool_name);
  54. if (api_is_allowed_to_create_course()) {
  55. echo '<div class="actions">';
  56. echo '<div style="float: right;"><a href="reservation.php">'.Display::return_icon('sessions.gif',get_lang('BookingCalendarView')).'&nbsp;'.get_lang('GoToCalendarView').'</a></div>';
  57. echo '<a href="m_item.php?view=list">'.Display::return_icon('cube.png',get_lang('Resources')).'&nbsp;'.get_lang('Resources').'</a>';
  58. echo '&nbsp;&nbsp;<a href="m_reservation.php?view=list">'.Display::return_icon('calendar_day.gif',get_lang('BookingPeriods')).'&nbsp;'.get_lang('BookingPeriods').'</a>';
  59. 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>';
  60. if (api_is_platform_admin()) {
  61. //echo '&nbsp;&nbsp;<a href="m_category.php">'.Display::return_icon('settings.gif',get_lang('Configuration')).'&nbsp;'.get_lang('Configuration').'</a>';
  62. }
  63. echo '</div><br />';
  64. }
  65. if (isset ($_POST['action'])) {
  66. switch ($_POST['action']) {
  67. case 'delete_subscriptions' :
  68. $ids = $_POST['subscriptions'];
  69. if (count($ids) > 0) {
  70. foreach ($ids as $id)
  71. Rsys :: delete_subscription(substr($id,0,strpos($id,'-')),substr($id,strrpos($id,'-')+1));
  72. }
  73. break;
  74. }
  75. }
  76. $table = new SortableTable('subscription', array('Rsys','get_num_subscriptions'),array('Rsys','get_table_subscriptions'),2);
  77. $table->set_header(0, '', false,array('style'=>'width:10px'));
  78. $table->set_header(1, get_lang('ResourceName'), true);
  79. $table->set_header(2, get_lang('StartDate'), true);
  80. $table->set_header(3, get_lang('EndDate'), true);
  81. $table->set_header(4, get_lang('Accept'), true);
  82. $table->set_header(5, get_lang('Modify'), false,array('style'=>'width:50px;'));
  83. $table->set_column_filter(5, 'modify_filter');
  84. $table->set_form_actions(array ('delete_subscriptions' => get_lang('DeleteSelectedSubscriptions')),'subscriptions');
  85. $table->display();
  86. }
  87. /**
  88. ---------------------------------------------------------------------
  89. */
  90. Display :: display_footer();
  91. ?>