session_edit.php 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Sessions edition script
  5. * @package chamilo.admin
  6. */
  7. // name of the language file that needs to be included
  8. $language_file ='admin';
  9. $cidReset = true;
  10. require_once '../inc/global.inc.php';
  11. // setting the section (for the tabs)
  12. $this_section = SECTION_PLATFORM_ADMIN;
  13. $formSent = 0;
  14. // Database Table Definitions
  15. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  16. $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
  17. $id = intval($_GET['id']);
  18. SessionManager::protect_session_edit($id);
  19. $infos = SessionManager::fetch($id);
  20. $id_coach = $infos['id_coach'];
  21. $tool_name = get_lang('EditSession');
  22. $interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
  23. $interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList'));
  24. $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview'));
  25. list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']);
  26. list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']);
  27. if (array_key_exists('calendar_start_date', $infos)) {
  28. list($calendarStartDateYear, $calendarStartDateMonth, $calendarStartDateDay) = explode('-', $infos['calendar_start_date']);
  29. }
  30. // Default value
  31. $showDescriptionChecked = 'checked';
  32. if (isset($infos['show_description'])) {
  33. if (!empty($infos['show_description'])) {
  34. $showDescriptionChecked = 'checked';
  35. } else {
  36. $showDescriptionChecked = null;
  37. }
  38. }
  39. $end_year_disabled = $end_month_disabled = $end_day_disabled = '';
  40. if (isset($_POST['formSent']) && $_POST['formSent']) {
  41. $formSent = 1;
  42. $name = $_POST['name'];
  43. $year_start = $_POST['year_start'];
  44. $month_start = $_POST['month_start'];
  45. $day_start = $_POST['day_start'];
  46. $year_end = $_POST['year_end'];
  47. $month_end = $_POST['month_end'];
  48. $day_end = $_POST['day_end'];
  49. $nb_days_acess_before = $_POST['nb_days_access_before'];
  50. $nb_days_acess_after = $_POST['nb_days_access_after'];
  51. //$nolimit = $_POST['nolimit'];
  52. $id_coach = $_POST['id_coach'];
  53. $id_session_category = $_POST['session_category'];
  54. $id_visibility = $_POST['session_visibility'];
  55. $duration = isset($_POST['duration']) ? $_POST['duration'] : null;
  56. $description = isset($_POST['description']) ? $_POST['description'] : null;
  57. $showDescription = isset($_POST['show_description']) ? 1 : 0;
  58. $end_limit = $_POST['end_limit'];
  59. $start_limit = $_POST['start_limit'];
  60. if (empty($end_limit) && empty($start_limit)) {
  61. $nolimit = 1;
  62. } else {
  63. $nolimit = null;
  64. }
  65. $calendarStartDay = isset($_POST['calendar_start_date_day']) ? $_POST['calendar_start_date_day'] : '';
  66. $calendarStartMonth = isset($_POST['calendar_start_date_month']) ? $_POST['calendar_start_date_month'] : '';
  67. $calendarStartYear = isset($_POST['calendar_start_date_year']) ? $_POST['calendar_start_date_year'] : '';
  68. $calendarStartDate = $calendarStartYear.'-'.$calendarStartMonth.'-'.$calendarStartDay.' 00:00:00';
  69. if (empty($calendarStartYear) || empty($calendarStartMonth) || empty($calendarStartDay)) {
  70. $calendarStartDate = '';
  71. }
  72. $return = SessionManager::edit_session(
  73. $id,
  74. $name,
  75. $year_start,
  76. $month_start,
  77. $day_start,
  78. $year_end,
  79. $month_end,
  80. $day_end,
  81. $nb_days_acess_before,
  82. $nb_days_acess_after,
  83. $nolimit,
  84. $id_coach,
  85. $id_session_category,
  86. $id_visibility,
  87. $start_limit,
  88. $end_limit,
  89. $description,
  90. $showDescription,
  91. $duration,
  92. $calendarStartDate
  93. );
  94. if ($return == strval(intval($return))) {
  95. header('Location: resume_session.php?id_session='.$return);
  96. exit();
  97. }
  98. }
  99. $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
  100. $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
  101. if (api_is_multiple_url_enabled()) {
  102. $table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  103. $access_url_id = api_get_current_access_url_id();
  104. if ($access_url_id != -1) {
  105. $sql="SELECT DISTINCT u.user_id,lastname,firstname,username FROM $tbl_user u INNER JOIN $table_access_url_rel_user url_rel_user ON (url_rel_user.user_id = u.user_id)
  106. WHERE status='1' AND access_url_id = '$access_url_id' $order_clause";
  107. }
  108. }
  109. $result = Database::query($sql);
  110. $Coaches = Database::store_result($result);
  111. $thisYear = date('Y');
  112. // display the header
  113. Display::display_header($tool_name);
  114. if (!empty($return)) {
  115. Display::display_error_message($return,false);
  116. }
  117. $page = isset($_GET['page']) && $_GET['page'] == 'resume_session.php' ? 'resume_session.php' : null;
  118. ?>
  119. <form class="form-horizontal" method="post" name="form" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id=<?php echo $id; ?>" style="margin:0px;">
  120. <fieldset>
  121. <legend><?php echo $tool_name; ?></legend>
  122. <input type="hidden" name="formSent" value="1">
  123. <div class="control-group">
  124. <label class="control-label">
  125. <?php echo get_lang('SessionName') ?>
  126. </label>
  127. <div class="controls">
  128. <input type="text" name="name" class="span4" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>">
  129. </div>
  130. </div>
  131. <div class="control-group">
  132. <label class="control-label">
  133. <?php echo get_lang('CoachName') ?>
  134. </label>
  135. <div class="controls">
  136. <select class="chzn-select" name="id_coach" style="width:380px;" title="<?php echo get_lang('Choose'); ?>" >
  137. <option value="">----- <?php echo get_lang('None') ?> -----</option>
  138. <?php foreach($Coaches as $enreg) { ?>
  139. <option value="<?php echo $enreg['user_id']; ?>" <?php if(($enreg['user_id'] == $infos['id_coach']) || ($enreg['user_id'] == $id_coach)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
  140. <?php
  141. }
  142. unset($Coaches);
  143. $Categories = SessionManager::get_all_session_category();
  144. ?>
  145. </select>
  146. </div>
  147. </div>
  148. <div class="control-group">
  149. <label class="control-label">
  150. <?php echo get_lang('SessionCategory') ?>
  151. </label>
  152. <div class="controls">
  153. <select class="chzn-select" id="session_category" name="session_category" style="width:380px;" title="<?php echo get_lang('Select'); ?>">
  154. <option value="0"><?php get_lang('None'); ?></option>
  155. <?php
  156. if (!empty($Categories)) {
  157. foreach($Categories as $Rows) { ?>
  158. <option value="<?php echo $Rows['id']; ?>" <?php if($Rows['id'] == $infos['session_category_id']) echo 'selected="selected"'; ?>><?php echo $Rows['name']; ?></option>
  159. <?php }
  160. }
  161. ?>
  162. </select>
  163. </div>
  164. </div>
  165. <div class="control-group">
  166. <div class="controls">
  167. <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>
  168. </div>
  169. </div>
  170. <div class="control-group">
  171. <div class="controls">
  172. <div style="display:
  173. <?php
  174. if($formSent){
  175. if($nb_days_access_before!=0 || $nb_days_access_after!=0)
  176. echo 'block';
  177. else echo 'none';
  178. }
  179. else{
  180. if($infos['nb_days_access_before_beginning']!=0 || $infos['nb_days_access_after_end']!=0)
  181. echo 'block';
  182. else
  183. echo 'none';
  184. }
  185. ?>
  186. ;" id="options">
  187. <input type="text" name="nb_days_access_before" value="<?php if($formSent) echo api_htmlentities($nb_days_access_before,ENT_QUOTES,$charset); else echo api_htmlentities($infos['nb_days_access_before_beginning'],ENT_QUOTES,$charset); ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysBefore') ?>
  188. <br />
  189. <br />
  190. <input type="text" name="nb_days_access_after" value="<?php if($formSent) echo api_htmlentities($nb_days_access_after,ENT_QUOTES,$charset); else echo api_htmlentities($infos['nb_days_access_after_end'],ENT_QUOTES,$charset); ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysAfter') ?>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="clear"></div>
  195. <div class="control-group">
  196. <div class="controls">
  197. <label for="start_limit">
  198. <input id="start_limit" type="checkbox" name="start_limit" onchange="disable_starttime(this)" <?php if ($year_start!="0000") echo "checked"; ?>/>
  199. <?php echo get_lang('DateStartSession');?>
  200. </label>
  201. <div id="start_date" style="<?php echo ($year_start=="0000") ? "display:none" : "display:block" ; ?>">
  202. <br />
  203. <select name="day_start">
  204. <option value="1">01</option>
  205. <option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option>
  206. <option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option>
  207. <option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option>
  208. <option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option>
  209. <option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option>
  210. <option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option>
  211. <option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option>
  212. <option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option>
  213. <option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option>
  214. <option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option>
  215. <option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option>
  216. <option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option>
  217. <option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option>
  218. <option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option>
  219. <option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option>
  220. <option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option>
  221. <option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option>
  222. <option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option>
  223. <option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option>
  224. <option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option>
  225. <option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option>
  226. <option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option>
  227. <option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option>
  228. <option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option>
  229. <option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option>
  230. <option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option>
  231. <option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option>
  232. <option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option>
  233. <option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option>
  234. <option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option>
  235. </select>
  236. /
  237. <select name="month_start">
  238. <option value="1">01</option>
  239. <option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option>
  240. <option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option>
  241. <option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option>
  242. <option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option>
  243. <option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option>
  244. <option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option>
  245. <option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option>
  246. <option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option>
  247. <option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option>
  248. <option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option>
  249. <option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option>
  250. </select>
  251. /
  252. <select name="year_start">
  253. <?php
  254. for($i=$thisYear-5;$i <= ($thisYear+5);$i++) { ?>
  255. <option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  256. <?php
  257. }
  258. ?>
  259. </select>
  260. </div>
  261. </div>
  262. </div>
  263. <div class="control-group">
  264. <div class="controls">
  265. <label for="end_limit">
  266. <input id="end_limit" type="checkbox" name="end_limit" onchange="disable_endtime(this)" <?php if ($year_end!="0000") echo "checked"; ?>/>
  267. <?php echo get_lang('DateEndSession') ?>
  268. </label>
  269. <div id="end_date" style="<?php echo ($year_end=="0000") ? "display:none" : "display:block" ; ?>">
  270. <br />
  271. <select name="day_end" <?php echo $end_day_disabled; ?> >
  272. <option value="1">01</option>
  273. <option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option>
  274. <option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option>
  275. <option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option>
  276. <option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option>
  277. <option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option>
  278. <option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option>
  279. <option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option>
  280. <option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option>
  281. <option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option>
  282. <option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option>
  283. <option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option>
  284. <option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option>
  285. <option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option>
  286. <option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option>
  287. <option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option>
  288. <option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option>
  289. <option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option>
  290. <option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option>
  291. <option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option>
  292. <option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option>
  293. <option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option>
  294. <option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option>
  295. <option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option>
  296. <option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option>
  297. <option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option>
  298. <option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option>
  299. <option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option>
  300. <option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option>
  301. <option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option>
  302. <option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option>
  303. </select>
  304. /
  305. <select name="month_end" <?php echo $end_month_disabled; ?> >
  306. <option value="1">01</option>
  307. <option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option>
  308. <option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option>
  309. <option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option>
  310. <option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option>
  311. <option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option>
  312. <option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option>
  313. <option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option>
  314. <option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option>
  315. <option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option>
  316. <option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option>
  317. <option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option>
  318. </select>
  319. /
  320. <select name="year_end" <?php echo $end_year_disabled; ?>>
  321. <?php
  322. for($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
  323. ?>
  324. <option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  325. <?php
  326. }
  327. ?>
  328. </select>
  329. <br /> <br />
  330. <?php echo get_lang('SessionVisibility') ?> <br />
  331. <select name="session_visibility" style="width:250px;">
  332. <?php
  333. $visibility_list = array(
  334. SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
  335. SESSION_VISIBLE => get_lang('SessionAccessible'),
  336. SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))
  337. );
  338. foreach($visibility_list as $key=>$item): ?>
  339. <option value="<?php echo $key; ?>" <?php if($key == $infos['visibility']) echo 'selected="selected"'; ?>><?php echo $item; ?></option>
  340. <?php endforeach; ?>
  341. </select>
  342. </div>
  343. </div>
  344. </div>
  345. <?php if (array_key_exists('show_description', $infos)) { ?>
  346. <div class="control-group">
  347. <div class="controls">
  348. <?php echo get_lang('Description') ?> <br />
  349. <textarea name="description"><?php echo $infos['description']; ?></textarea>
  350. </div>
  351. </div>
  352. <div class="control-group">
  353. <div class="controls">
  354. <label>
  355. <input id="show_description" type="checkbox" name="show_description" <?php echo $showDescriptionChecked ?> />
  356. <?php echo get_lang('ShowDescription') ?>
  357. </label>
  358. </div>
  359. </div>
  360. <?php } ?>
  361. <?php
  362. if (SessionManager::durationPerUserIsEnabled()) {
  363. if (empty($infos['duration'])) {
  364. $duration = null;
  365. } else {
  366. $duration = $infos['duration'];
  367. }
  368. ?>
  369. <div class="control-group">
  370. <label class="control-label">
  371. <?php echo get_lang('SessionDurationTitle') ?> <br />
  372. </label>
  373. <div class="controls">
  374. <input id="duration" type="text" name="duration" class="span1" maxlength="50" value="<?php if($formSent) echo Security::remove_XSS($duration); else echo $duration; ?>">
  375. <br />
  376. <?php echo get_lang('SessionDurationDescription') ?>
  377. </div>
  378. </div>
  379. <?php
  380. }
  381. if (array_key_exists('calendar_start_date', $infos)) {
  382. ?>
  383. <div class="control-group">
  384. <label class="control-label">
  385. <?php echo get_lang('CalendarStartDate') ?>
  386. </label>
  387. <div class="controls">
  388. <select name="calendar_start_date_day" >
  389. <option value=""></option>
  390. <option value="1" <?php if($calendarStartDateDay == 1) echo 'selected="selected"'; ?> >01</option>
  391. <option value="2" <?php if($calendarStartDateDay == 2) echo 'selected="selected"'; ?> >02</option>
  392. <option value="3" <?php if($calendarStartDateDay == 3) echo 'selected="selected"'; ?> >03</option>
  393. <option value="4" <?php if($calendarStartDateDay == 4) echo 'selected="selected"'; ?> >04</option>
  394. <option value="5" <?php if($calendarStartDateDay == 5) echo 'selected="selected"'; ?> >05</option>
  395. <option value="6" <?php if($calendarStartDateDay == 6) echo 'selected="selected"'; ?> >06</option>
  396. <option value="7" <?php if($calendarStartDateDay == 7) echo 'selected="selected"'; ?> >07</option>
  397. <option value="8" <?php if($calendarStartDateDay == 8) echo 'selected="selected"'; ?> >08</option>
  398. <option value="9" <?php if($calendarStartDateDay == 9) echo 'selected="selected"'; ?> >09</option>
  399. <option value="10" <?php if($calendarStartDateDay == 10) echo 'selected="selected"'; ?> >10</option>
  400. <option value="11" <?php if($calendarStartDateDay == 11) echo 'selected="selected"'; ?> >11</option>
  401. <option value="12" <?php if($calendarStartDateDay == 12) echo 'selected="selected"'; ?> >12</option>
  402. <option value="13" <?php if($calendarStartDateDay == 13) echo 'selected="selected"'; ?> >13</option>
  403. <option value="14" <?php if($calendarStartDateDay == 14) echo 'selected="selected"'; ?> >14</option>
  404. <option value="15" <?php if($calendarStartDateDay == 15) echo 'selected="selected"'; ?> >15</option>
  405. <option value="16" <?php if($calendarStartDateDay == 16) echo 'selected="selected"'; ?> >16</option>
  406. <option value="17" <?php if($calendarStartDateDay == 17) echo 'selected="selected"'; ?> >17</option>
  407. <option value="18" <?php if($calendarStartDateDay == 18) echo 'selected="selected"'; ?> >18</option>
  408. <option value="19" <?php if($calendarStartDateDay == 19) echo 'selected="selected"'; ?> >19</option>
  409. <option value="20" <?php if($calendarStartDateDay == 20) echo 'selected="selected"'; ?> >20</option>
  410. <option value="21" <?php if($calendarStartDateDay == 21) echo 'selected="selected"'; ?> >21</option>
  411. <option value="22" <?php if($calendarStartDateDay == 22) echo 'selected="selected"'; ?> >22</option>
  412. <option value="23" <?php if($calendarStartDateDay == 23) echo 'selected="selected"'; ?> >23</option>
  413. <option value="24" <?php if($calendarStartDateDay == 24) echo 'selected="selected"'; ?> >24</option>
  414. <option value="25" <?php if($calendarStartDateDay == 25) echo 'selected="selected"'; ?> >25</option>
  415. <option value="26" <?php if($calendarStartDateDay == 26) echo 'selected="selected"'; ?> >26</option>
  416. <option value="27" <?php if($calendarStartDateDay == 27) echo 'selected="selected"'; ?> >27</option>
  417. <option value="28" <?php if($calendarStartDateDay == 28) echo 'selected="selected"'; ?> >28</option>
  418. <option value="29" <?php if($calendarStartDateDay == 29) echo 'selected="selected"'; ?> >29</option>
  419. <option value="30" <?php if($calendarStartDateDay == 30) echo 'selected="selected"'; ?> >30</option>
  420. <option value="31" <?php if($calendarStartDateDay == 31) echo 'selected="selected"'; ?> >31</option>
  421. </select>
  422. /
  423. <select name="calendar_start_date_month">
  424. <option value=""></option>
  425. <option value="1" <?php if($calendarStartDateMonth == 1) echo 'selected="selected"'; ?> >01</option>
  426. <option value="2" <?php if($calendarStartDateMonth == 2) echo 'selected="selected"'; ?> >02</option>
  427. <option value="3" <?php if($calendarStartDateMonth == 3) echo 'selected="selected"'; ?> >03</option>
  428. <option value="4" <?php if($calendarStartDateMonth == 4) echo 'selected="selected"'; ?> >04</option>
  429. <option value="5" <?php if($calendarStartDateMonth == 5) echo 'selected="selected"'; ?> >05</option>
  430. <option value="6" <?php if($calendarStartDateMonth == 6) echo 'selected="selected"'; ?> >06</option>
  431. <option value="7" <?php if($calendarStartDateMonth == 7) echo 'selected="selected"'; ?> >07</option>
  432. <option value="8" <?php if($calendarStartDateMonth == 8) echo 'selected="selected"'; ?> >08</option>
  433. <option value="9" <?php if($calendarStartDateMonth == 9) echo 'selected="selected"'; ?> >09</option>
  434. <option value="10" <?php if($calendarStartDateMonth == 10) echo 'selected="selected"'; ?> >10</option>
  435. <option value="11" <?php if($calendarStartDateMonth == 11) echo 'selected="selected"'; ?> >11</option>
  436. <option value="12" <?php if($calendarStartDateMonth == 12) echo 'selected="selected"'; ?> >12</option>
  437. </select>
  438. /
  439. <select name="calendar_start_date_year">
  440. <option value=""></option>
  441. <?php
  442. for($i=$thisYear-2;$i <= ($thisYear+5);$i++) {
  443. ?>
  444. <option value="<?php echo $i; ?>" <?php if($calendarStartDateYear == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  445. <?php
  446. }
  447. ?>
  448. </select>
  449. </div>
  450. </div>
  451. <?php
  452. }
  453. ?>
  454. <div class="control-group">
  455. <div class="controls">
  456. <button class="save" type="submit" value="<?php echo get_lang('ModifyThisSession') ?>"><?php echo get_lang('ModifyThisSession') ?></button>
  457. </div>
  458. </div>
  459. </fieldset>
  460. </form>
  461. <script type="text/javascript">
  462. <?php
  463. //if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n";
  464. ?>
  465. function setDisable(select) {
  466. document.form.day_start.disabled = (select.checked) ? true : false;
  467. document.form.month_start.disabled = (select.checked) ? true : false;
  468. document.form.year_start.disabled = (select.checked) ? true : false;
  469. document.form.day_end.disabled = (select.checked) ? true : false;
  470. document.form.month_end.disabled = (select.checked) ? true : false;
  471. document.form.year_end.disabled = (select.checked) ? true : false;
  472. document.form.session_visibility.disabled = (select.checked) ? true : false;
  473. document.form.session_visibility.selectedIndex = 0;
  474. document.form.start_limit.disabled = (select.checked) ? true : false;
  475. document.form.start_limit.checked = false;
  476. document.form.end_limit.disabled = (select.checked) ? true : false;
  477. document.form.end_limit.checked = false;
  478. var end_div = document.getElementById('end_date');
  479. end_div.style.display = 'none';
  480. var start_div = document.getElementById('start_date');
  481. start_div.style.display = 'none';
  482. }
  483. function disable_endtime(select) {
  484. var end_div = document.getElementById('end_date');
  485. if (end_div.style.display == 'none')
  486. end_div.style.display = 'block';
  487. else
  488. end_div.style.display = 'none';
  489. emptyDuration();
  490. }
  491. function disable_starttime(select) {
  492. var start_div = document.getElementById('start_date');
  493. if (start_div.style.display == 'none')
  494. start_div.style.display = 'block';
  495. else
  496. start_div.style.display = 'none';
  497. emptyDuration();
  498. }
  499. function emptyDuration() {
  500. if ($('#duration').val()) {
  501. $('#duration').val('');
  502. }
  503. }
  504. </script>
  505. <?php
  506. Display::display_footer();