session_add.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2009 Dokeos SPRL
  6. For a full list of contributors, see "credits.txt".
  7. The full license can be read in "license.txt".
  8. This program is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU General Public License
  10. as published by the Free Software Foundation; either version 2
  11. of the License, or (at your option) any later version.
  12. See the GNU General Public License for more details.
  13. Contact: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium, info@dokeos.com
  14. ==============================================================================
  15. */
  16. /**
  17. ==============================================================================
  18. * @package dokeos.admin
  19. * @todo use formvalidator for the form
  20. ==============================================================================
  21. */
  22. // name of the language file that needs to be included
  23. $language_file='admin';
  24. $cidReset=true;
  25. // including the global Dokeos file
  26. require_once('../inc/global.inc.php');
  27. // including additional libraries
  28. require_once(api_get_path(LIBRARY_PATH).'sessionmanager.lib.php');
  29. require_once('../inc/lib/xajax/xajax.inc.php');
  30. $xajax = new xajax();
  31. //$xajax->debugOn();
  32. $xajax -> registerFunction ('search_coachs');
  33. // setting the section (for the tabs)
  34. $this_section=SECTION_PLATFORM_ADMIN;
  35. api_protect_admin_script(true);
  36. $formSent=0;
  37. $errorMsg='';
  38. $interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
  39. $interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang('SessionList'));
  40. // Database Table Definitions
  41. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  42. $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
  43. function search_coachs($needle)
  44. {
  45. global $tbl_user;
  46. $xajax_response = new XajaxResponse();
  47. $return = '';
  48. if(!empty($needle))
  49. {
  50. // xajax send utf8 datas... datas in db can be non-utf8 datas
  51. $charset = api_get_setting('platform_charset');
  52. $needle = api_convert_encoding($needle, $charset, 'utf-8');
  53. // search users where username or firstname or lastname begins likes $needle
  54. $sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
  55. WHERE (username LIKE "'.$needle.'%"
  56. OR firstname LIKE "'.$needle.'%"
  57. OR lastname LIKE "'.$needle.'%")
  58. AND status=1
  59. ORDER BY lastname, firstname, username
  60. LIMIT 10';
  61. global $_configuration;
  62. if ($_configuration['multiple_access_urls']==true) {
  63. $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  64. $access_url_id = api_get_current_access_url_id();
  65. if ($access_url_id != -1){
  66. $sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
  67. INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
  68. WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
  69. OR firstname LIKE "'.$needle.'%"
  70. OR lastname LIKE "'.$needle.'%")
  71. AND status=1
  72. ORDER BY lastname, firstname, username
  73. LIMIT 10';
  74. }
  75. }
  76. $rs = api_sql_query($sql, __FILE__, __LINE__);
  77. while ($user = Database :: fetch_array($rs)) {
  78. $return .= '<a href="#" onclick="fill_coach_field(\''.$user['username'].'\')">'.$user['lastname'].' '.$user['firstname'].' ('.$user['username'].')</a><br />';
  79. }
  80. }
  81. $xajax_response -> addAssign('ajax_list_coachs','innerHTML',api_utf8_encode($return));
  82. return $xajax_response;
  83. }
  84. $xajax -> processRequests();
  85. $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
  86. $htmlHeadXtra[] = '
  87. <script type="text/javascript">
  88. function fill_coach_field (username) {
  89. document.getElementById("coach_username").value = username;
  90. document.getElementById("ajax_list_coachs").innerHTML = "";
  91. }
  92. </script>';
  93. if ($_POST['formSent']) {
  94. $formSent=1;
  95. $name= $_POST['name'];
  96. $year_start= $_POST['year_start'];
  97. $month_start=$_POST['month_start'];
  98. $day_start=$_POST['day_start'];
  99. $year_end=$_POST['year_end'];
  100. $month_end=$_POST['month_end'];
  101. $day_end=$_POST['day_end'];
  102. $nb_days_acess_before = $_POST['nb_days_acess_before'];
  103. $nb_days_acess_after = $_POST['nb_days_acess_after'];
  104. $nolimit=$_POST['nolimit'];
  105. $coach_username=$_POST['coach_username'];
  106. $return = SessionManager::create_session($name,$year_start,$month_start,$day_start,$year_end,$month_end,$day_end,$nb_days_acess_before,$nb_days_acess_after,$nolimit,$coach_username);
  107. if ($return == strval(intval($return))) {
  108. // integer => no error on session creation
  109. header('Location: add_courses_to_session.php?id_session='.$return.'&add=true&msg=');
  110. exit();
  111. }
  112. }
  113. $nb_days_acess_before = 0;
  114. $nb_days_acess_after = 0;
  115. $thisYear=date('Y');
  116. $thisMonth=date('m');
  117. $thisDay=date('d');
  118. $tool_name = get_lang('AddSession');
  119. //display the header
  120. Display::display_header($tool_name);
  121. // display the tool title
  122. // api_display_tool_title($tool_name);
  123. if (!empty($return)) {
  124. Display::display_error_message($return,false);
  125. }
  126. ?>
  127. <form method="post" name="form" action="<?php echo api_get_self(); ?>" style="margin:0px;">
  128. <input type="hidden" name="formSent" value="1">
  129. <div class="row"><div class="form_header"><?php echo $tool_name; ?></div></div>
  130. <table border="0" cellpadding="5" cellspacing="0" width="550">
  131. <tr>
  132. <td width="30%"><?php echo get_lang('SessionName') ?>&nbsp;&nbsp;</td>
  133. <td width="70%"><input type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>"></td>
  134. </tr>
  135. <tr>
  136. <td width="30%"><?php echo get_lang('CoachName') ?>&nbsp;&nbsp;</td>
  137. <td width="70%">
  138. <?php
  139. $sql = 'SELECT COUNT(1) FROM '.$tbl_user.' WHERE status=1';
  140. $rs = api_sql_query($sql, __FILE__, __LINE__);
  141. $count_users = Database::result($rs, 0, 0);
  142. if (intval($count_users)<50) {
  143. $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1' ORDER BY lastname,firstname,username";
  144. global $_configuration;
  145. if ($_configuration['multiple_access_urls']==true) {
  146. $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  147. $access_url_id = api_get_current_access_url_id();
  148. if ($access_url_id != -1){
  149. $sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
  150. INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
  151. WHERE access_url_id = '.$access_url_id.' AND status=1
  152. ORDER BY lastname, firstname, username';
  153. }
  154. }
  155. $result=api_sql_query($sql,__FILE__,__LINE__);
  156. $Coaches=api_store_result($result);
  157. ?>
  158. <select name="coach_username" value="true" style="width:250px;">
  159. <option value="0"><?php get_lang('None'); ?></option>
  160. <?php foreach($Coaches as $enreg): ?>
  161. <option value="<?php echo $enreg['username']; ?>" <?php if($sent && $enreg['user_id'] == $id_coach) echo 'selected="selected"'; ?>><?php echo $enreg['firstname'].' '.$enreg['lastname'].' ('.$enreg['username'].')'; ?></option>
  162. <?php endforeach; ?>
  163. </select>
  164. <?php
  165. } else {
  166. ?>
  167. <input type="text" name="coach_username" id="coach_username" onkeyup="xajax_search_coachs(document.getElementById('coach_username').value)" /><div id="ajax_list_coachs"></div>
  168. <?php
  169. }
  170. ?>
  171. </td>
  172. </tr>
  173. <tr>
  174. <td width="30%"><?php echo get_lang('NoTimeLimits') ?></td>
  175. <td width="70%">
  176. <input type="checkbox" name="nolimit" onChange="setDisable(this)" />
  177. </td>
  178. <tr>
  179. <td width="30%"><?php echo get_lang('DateStart') ?>&nbsp;&nbsp;</td>
  180. <td width="70%">
  181. <select name="day_start">
  182. <option value="1">01</option>
  183. <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) echo 'selected="selected"'; ?> >02</option>
  184. <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) echo 'selected="selected"'; ?> >03</option>
  185. <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) echo 'selected="selected"'; ?> >04</option>
  186. <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) echo 'selected="selected"'; ?> >05</option>
  187. <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) echo 'selected="selected"'; ?> >06</option>
  188. <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) echo 'selected="selected"'; ?> >07</option>
  189. <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) echo 'selected="selected"'; ?> >08</option>
  190. <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) echo 'selected="selected"'; ?> >09</option>
  191. <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) echo 'selected="selected"'; ?> >10</option>
  192. <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) echo 'selected="selected"'; ?> >11</option>
  193. <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) echo 'selected="selected"'; ?> >12</option>
  194. <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) echo 'selected="selected"'; ?> >13</option>
  195. <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) echo 'selected="selected"'; ?> >14</option>
  196. <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) echo 'selected="selected"'; ?> >15</option>
  197. <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) echo 'selected="selected"'; ?> >16</option>
  198. <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) echo 'selected="selected"'; ?> >17</option>
  199. <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) echo 'selected="selected"'; ?> >18</option>
  200. <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) echo 'selected="selected"'; ?> >19</option>
  201. <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) echo 'selected="selected"'; ?> >20</option>
  202. <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) echo 'selected="selected"'; ?> >21</option>
  203. <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) echo 'selected="selected"'; ?> >22</option>
  204. <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) echo 'selected="selected"'; ?> >23</option>
  205. <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) echo 'selected="selected"'; ?> >24</option>
  206. <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) echo 'selected="selected"'; ?> >25</option>
  207. <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) echo 'selected="selected"'; ?> >26</option>
  208. <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) echo 'selected="selected"'; ?> >27</option>
  209. <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) echo 'selected="selected"'; ?> >28</option>
  210. <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) echo 'selected="selected"'; ?> >29</option>
  211. <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) echo 'selected="selected"'; ?> >30</option>
  212. <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) echo 'selected="selected"'; ?> >31</option>
  213. </select>
  214. /
  215. <select name="month_start">
  216. <option value="1">01</option>
  217. <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) echo 'selected="selected"'; ?> >02</option>
  218. <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) echo 'selected="selected"'; ?> >03</option>
  219. <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) echo 'selected="selected"'; ?> >04</option>
  220. <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) echo 'selected="selected"'; ?> >05</option>
  221. <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) echo 'selected="selected"'; ?> >06</option>
  222. <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) echo 'selected="selected"'; ?> >07</option>
  223. <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) echo 'selected="selected"'; ?> >08</option>
  224. <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) echo 'selected="selected"'; ?> >09</option>
  225. <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) echo 'selected="selected"'; ?> >10</option>
  226. <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) echo 'selected="selected"'; ?> >11</option>
  227. <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) echo 'selected="selected"'; ?> >12</option>
  228. </select>
  229. /
  230. <select name="year_start">
  231. <?php
  232. for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
  233. ?>
  234. <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  235. <?php
  236. }
  237. ?>
  238. </select>
  239. </td>
  240. </tr>
  241. <tr>
  242. <td width="30%"><?php echo get_lang('DateEnd') ?>&nbsp;&nbsp;</td>
  243. <td width="70%">
  244. <select name="day_end">
  245. <option value="1">01</option>
  246. <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_end == 2)) echo 'selected="selected"'; ?> >02</option>
  247. <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_end == 3)) echo 'selected="selected"'; ?> >03</option>
  248. <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_end == 4)) echo 'selected="selected"'; ?> >04</option>
  249. <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_end == 5)) echo 'selected="selected"'; ?> >05</option>
  250. <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_end == 6)) echo 'selected="selected"'; ?> >06</option>
  251. <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_end == 7)) echo 'selected="selected"'; ?> >07</option>
  252. <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_end == 8)) echo 'selected="selected"'; ?> >08</option>
  253. <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_end == 9)) echo 'selected="selected"'; ?> >09</option>
  254. <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_end == 10)) echo 'selected="selected"'; ?> >10</option>
  255. <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_end == 11)) echo 'selected="selected"'; ?> >11</option>
  256. <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_end == 12)) echo 'selected="selected"'; ?> >12</option>
  257. <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_end == 13)) echo 'selected="selected"'; ?> >13</option>
  258. <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_end == 14)) echo 'selected="selected"'; ?> >14</option>
  259. <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_end == 15)) echo 'selected="selected"'; ?> >15</option>
  260. <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_end == 16)) echo 'selected="selected"'; ?> >16</option>
  261. <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_end == 17)) echo 'selected="selected"'; ?> >17</option>
  262. <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_end == 18)) echo 'selected="selected"'; ?> >18</option>
  263. <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_end == 19)) echo 'selected="selected"'; ?> >19</option>
  264. <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_end == 20)) echo 'selected="selected"'; ?> >20</option>
  265. <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_end == 21)) echo 'selected="selected"'; ?> >21</option>
  266. <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_end == 22)) echo 'selected="selected"'; ?> >22</option>
  267. <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_end == 23)) echo 'selected="selected"'; ?> >23</option>
  268. <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_end == 24)) echo 'selected="selected"'; ?> >24</option>
  269. <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_end == 25)) echo 'selected="selected"'; ?> >25</option>
  270. <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_end == 26)) echo 'selected="selected"'; ?> >26</option>
  271. <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_end == 27)) echo 'selected="selected"'; ?> >27</option>
  272. <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_end == 28)) echo 'selected="selected"'; ?> >28</option>
  273. <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_end == 29)) echo 'selected="selected"'; ?> >29</option>
  274. <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_end == 30)) echo 'selected="selected"'; ?> >30</option>
  275. <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_end == 31)) echo 'selected="selected"'; ?> >31</option>
  276. </select>
  277. /
  278. <select name="month_end">
  279. <option value="1">01</option>
  280. <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_end == 2)) echo 'selected="selected"'; ?> >02</option>
  281. <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_end == 3)) echo 'selected="selected"'; ?> >03</option>
  282. <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_end == 4)) echo 'selected="selected"'; ?> >04</option>
  283. <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_end == 5)) echo 'selected="selected"'; ?> >05</option>
  284. <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_end == 6)) echo 'selected="selected"'; ?> >06</option>
  285. <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_end == 7)) echo 'selected="selected"'; ?> >07</option>
  286. <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_end == 8)) echo 'selected="selected"'; ?> >08</option>
  287. <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_end == 9)) echo 'selected="selected"'; ?> >09</option>
  288. <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_end == 10)) echo 'selected="selected"'; ?> >10</option>
  289. <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_end == 11)) echo 'selected="selected"'; ?> >11</option>
  290. <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_end == 12)) echo 'selected="selected"'; ?> >12</option>
  291. </select>
  292. /
  293. <select name="year_end">
  294. <?php
  295. for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
  296. ?>
  297. <option value="<?php echo $i; ?>" <?php if((!$formSent && ($thisYear+1) == $i) || ($formSent && $year_end == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  298. <?php
  299. }
  300. ?>
  301. </select>
  302. </td>
  303. </tr>
  304. <tr>
  305. <td>
  306. &nbsp;
  307. </td>
  308. <td>
  309. <a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('DefineSessionOptions') ?></a>
  310. <div style="display: <?php if($formSent && ($nb_days_acess_before!=0 || $nb_days_acess_after!=0)) echo 'block'; else echo 'none'; ?>;" id="options">
  311. <br>
  312. <input type="text" name="nb_days_acess_before" value="<?php echo $nb_days_acess_before; ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysBefore') ?><br>
  313. <input type="text" name="nb_days_acess_after" value="<?php echo $nb_days_acess_after; ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysAfter') ?>
  314. <br>
  315. </div>
  316. </td>
  317. </tr>
  318. <tr>
  319. <td>&nbsp;</td>
  320. <td><button class="save" type="submit" value="<?php echo get_lang('NextStep') ?>"><?php echo get_lang('NextStep') ?></button>
  321. </td>
  322. </tr>
  323. </table>
  324. </form>
  325. <script type="text/javascript">
  326. function setDisable(select) {
  327. document.form.day_start.disabled = (select.checked) ? true : false;
  328. document.form.month_start.disabled = (select.checked) ? true : false;
  329. document.form.year_start.disabled = (select.checked) ? true : false;
  330. document.form.day_end.disabled = (select.checked) ? true : false;
  331. document.form.month_end.disabled = (select.checked) ? true : false;
  332. document.form.year_end.disabled = (select.checked) ? true : false;
  333. }
  334. </script>
  335. <?php
  336. Display::display_footer();
  337. ?>