session_add.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.admin
  5. * @todo use formvalidator for the form, remove all the select harcoded values
  6. */
  7. // name of the language file that needs to be included
  8. $language_file='admin';
  9. $cidReset=true;
  10. // including the global Chamilo file
  11. require_once '../inc/global.inc.php';
  12. // including additional libraries
  13. require_once '../inc/lib/xajax/xajax.inc.php';
  14. $xajax = new xajax();
  15. //$xajax->debugOn();
  16. $xajax -> registerFunction ('search_coachs');
  17. // setting the section (for the tabs)
  18. $this_section=SECTION_PLATFORM_ADMIN;
  19. api_protect_admin_script(true);
  20. $formSent=0;
  21. $errorMsg='';
  22. $interbreadcrumb[]=array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
  23. $interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList'));
  24. // Database Table Definitions
  25. $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
  26. function search_coachs($needle) {
  27. global $tbl_user;
  28. $xajax_response = new XajaxResponse();
  29. $return = '';
  30. if(!empty($needle)) {
  31. // xajax send utf8 datas... datas in db can be non-utf8 datas
  32. $charset = api_get_system_encoding();
  33. $needle = api_convert_encoding($needle, $charset, 'utf-8');
  34. $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
  35. // search users where username or firstname or lastname begins likes $needle
  36. $sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
  37. WHERE (username LIKE "'.$needle.'%"
  38. OR firstname LIKE "'.$needle.'%"
  39. OR lastname LIKE "'.$needle.'%")
  40. AND status=1'.
  41. $order_clause.
  42. ' LIMIT 10';
  43. global $_configuration;
  44. if ($_configuration['multiple_access_urls']) {
  45. $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  46. $access_url_id = api_get_current_access_url_id();
  47. if ($access_url_id != -1){
  48. $sql = 'SELECT username, lastname, firstname FROM '.$tbl_user.' user
  49. INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
  50. WHERE access_url_id = '.$access_url_id.' AND (username LIKE "'.$needle.'%"
  51. OR firstname LIKE "'.$needle.'%"
  52. OR lastname LIKE "'.$needle.'%")
  53. AND status=1'.
  54. $order_clause.
  55. ' LIMIT 10';
  56. }
  57. }
  58. $rs = Database::query($sql);
  59. while ($user = Database :: fetch_array($rs)) {
  60. $return .= '<a href="javascript: void(0);" onclick="javascript: fill_coach_field(\''.$user['username'].'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
  61. }
  62. }
  63. $xajax_response -> addAssign('ajax_list_coachs','innerHTML', api_utf8_encode($return));
  64. return $xajax_response;
  65. }
  66. $xajax -> processRequests();
  67. $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
  68. $htmlHeadXtra[] = '
  69. <script type="text/javascript">
  70. function fill_coach_field (username) {
  71. document.getElementById("coach_username").value = username;
  72. document.getElementById("ajax_list_coachs").innerHTML = "";
  73. }
  74. </script>';
  75. if ($_POST['formSent']) {
  76. $formSent = 1;
  77. $name = $_POST['name'];
  78. $year_start = $_POST['year_start'];
  79. $month_start = $_POST['month_start'];
  80. $day_start = $_POST['day_start'];
  81. $year_end = $_POST['year_end'];
  82. $month_end = $_POST['month_end'];
  83. $day_end = $_POST['day_end'];
  84. $nb_days_acess_before = $_POST['nb_days_acess_before'];
  85. $nb_days_acess_after = $_POST['nb_days_acess_after'];
  86. //$nolimit = $_POST['nolimit'];
  87. $coach_username = $_POST['coach_username'];
  88. $id_session_category = $_POST['session_category'];
  89. $id_visibility = $_POST['session_visibility'];
  90. $end_limit = $_POST['end_limit'];
  91. $start_limit = $_POST['start_limit'];
  92. if (empty($end_limit) && empty($start_limit)) {
  93. $nolimit = 1;
  94. } else {
  95. $nolimit = null;
  96. }
  97. $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, $id_session_category,$id_visibility, $start_limit, $end_limit);
  98. if ($return == strval(intval($return))) {
  99. // integer => no error on session creation
  100. header('Location: add_courses_to_session.php?id_session='.$return.'&add=true&msg=');
  101. exit();
  102. }
  103. }
  104. $nb_days_acess_before = 0;
  105. $nb_days_acess_after = 0;
  106. $thisYear=date('Y');
  107. $thisMonth=date('m');
  108. $thisDay=date('d');
  109. $tool_name = get_lang('AddSession');
  110. Display::display_header($tool_name);
  111. if (!empty($return)) {
  112. Display::display_error_message($return,false);
  113. }
  114. echo '<div class="actions">';
  115. echo '<a href="../admin/index.php">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'),'',ICON_SIZE_MEDIUM).'</a>';
  116. echo '</div>';
  117. ?>
  118. <form class="form-horizontal" method="post" name="form" action="<?php echo api_get_self(); ?>" style="margin:0px;">
  119. <input type="hidden" name="formSent" value="1">
  120. <div class="control-group">
  121. <label class="control-label">
  122. <?php echo get_lang('SessionName') ?>
  123. </label>
  124. <div class="controls">
  125. <input type="text" name="name" class="span4" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); ?>">
  126. </div>
  127. </div>
  128. <div class="control-group">
  129. <label class="control-label">
  130. <?php echo get_lang('CoachName') ?>
  131. </label>
  132. <div class="controls">
  133. <?php
  134. $sql = 'SELECT COUNT(1) FROM '.$tbl_user.' WHERE status=1';
  135. $rs = Database::query($sql);
  136. $count_users = Database::result($rs, 0, 0);
  137. if (intval($count_users)<50) {
  138. $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username';
  139. $sql="SELECT user_id, lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause;
  140. global $_configuration;
  141. if ($_configuration['multiple_access_urls']) {
  142. $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
  143. $access_url_id = api_get_current_access_url_id();
  144. if ($access_url_id != -1){
  145. $sql = 'SELECT user.user_id, username, lastname, firstname FROM '.$tbl_user.' user
  146. INNER JOIN '.$tbl_user_rel_access_url.' url_user ON (url_user.user_id=user.user_id)
  147. WHERE access_url_id = '.$access_url_id.' AND status=1'.$order_clause;
  148. }
  149. }
  150. $result = Database::query($sql);
  151. $Coaches = Database::store_result($result);
  152. ?>
  153. <select id="coach_username" class="chzn-select" name="coach_username" style="width:350px;" title="<?php echo get_lang('Select'); ?>" >
  154. <option value="0"><?php get_lang('None'); ?></option>
  155. <?php foreach($Coaches as $enreg): ?>
  156. <option value="<?php echo $enreg['username']; ?>"> <?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option>
  157. <?php endforeach; ?>
  158. </select>
  159. <?php
  160. echo Display::return_icon('synthese_view.gif',get_lang('ActivityCoach'));
  161. } else {
  162. ?>
  163. <input type="text" name="coach_username" id="coach_username" onkeyup="xajax_search_coachs(document.getElementById('coach_username').value)" /><div id="ajax_list_coachs"></div>
  164. <?php
  165. }
  166. $Categories = SessionManager::get_all_session_category();
  167. ?>
  168. </div>
  169. </div>
  170. <div class="control-group">
  171. <label class="control-label">
  172. <?php echo get_lang('SessionCategory') ?>
  173. </label>
  174. <div class="controls">
  175. <select id="session_category" class="chzn-select" name="session_category" style="width:350px;" title="<?php echo get_lang('Select'); ?>">
  176. <option value="0"><?php get_lang('None'); ?></option>
  177. <?php
  178. if (!empty($Categories)) {
  179. foreach($Categories as $Rows) { ?>
  180. <option value="<?php echo $Rows['id']; ?>" <?php if($Rows['id'] == $id_session_category) echo 'selected="selected"'; ?>><?php echo $Rows['name']; ?></option>
  181. <?php }
  182. }
  183. ?>
  184. </select>
  185. </div>
  186. </div>
  187. <div class="control-group">
  188. <div class="controls">
  189. <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>
  190. <div style="display: <?php if($formSent && ($nb_days_acess_before!=0 || $nb_days_acess_after!=0)) echo 'block'; else echo 'none'; ?>;" id="options">
  191. <br />
  192. <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 /><br />
  193. <input type="text" name="nb_days_acess_after" value="<?php echo $nb_days_acess_after; ?>" style="width: 30px;">&nbsp;<?php echo get_lang('DaysAfter') ?>
  194. <br />
  195. </div>
  196. </div>
  197. </div>
  198. <div class="control-group">
  199. <div class="controls">
  200. <label for="start_limit">
  201. <input id="start_limit" type="checkbox" name="start_limit" onchange="disable_starttime(this)" />
  202. <?php echo get_lang('DateStartSession');?>
  203. </label>
  204. <div id="start_date" style="display:none">
  205. <br />
  206. <select name="day_start">
  207. <option value="1">01</option>
  208. <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_start == 2)) echo 'selected="selected"'; ?> >02</option>
  209. <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_start == 3)) echo 'selected="selected"'; ?> >03</option>
  210. <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_start == 4)) echo 'selected="selected"'; ?> >04</option>
  211. <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_start == 5)) echo 'selected="selected"'; ?> >05</option>
  212. <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_start == 6)) echo 'selected="selected"'; ?> >06</option>
  213. <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_start == 7)) echo 'selected="selected"'; ?> >07</option>
  214. <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_start == 8)) echo 'selected="selected"'; ?> >08</option>
  215. <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_start == 9)) echo 'selected="selected"'; ?> >09</option>
  216. <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_start == 10)) echo 'selected="selected"'; ?> >10</option>
  217. <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_start == 11)) echo 'selected="selected"'; ?> >11</option>
  218. <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_start == 12)) echo 'selected="selected"'; ?> >12</option>
  219. <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_start == 13)) echo 'selected="selected"'; ?> >13</option>
  220. <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_start == 14)) echo 'selected="selected"'; ?> >14</option>
  221. <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_start == 15)) echo 'selected="selected"'; ?> >15</option>
  222. <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_start == 16)) echo 'selected="selected"'; ?> >16</option>
  223. <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_start == 17)) echo 'selected="selected"'; ?> >17</option>
  224. <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_start == 18)) echo 'selected="selected"'; ?> >18</option>
  225. <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_start == 19)) echo 'selected="selected"'; ?> >19</option>
  226. <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_start == 20)) echo 'selected="selected"'; ?> >20</option>
  227. <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_start == 21)) echo 'selected="selected"'; ?> >21</option>
  228. <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_start == 22)) echo 'selected="selected"'; ?> >22</option>
  229. <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_start == 23)) echo 'selected="selected"'; ?> >23</option>
  230. <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_start == 24)) echo 'selected="selected"'; ?> >24</option>
  231. <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_start == 25)) echo 'selected="selected"'; ?> >25</option>
  232. <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_start == 26)) echo 'selected="selected"'; ?> >26</option>
  233. <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_start == 27)) echo 'selected="selected"'; ?> >27</option>
  234. <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_start == 28)) echo 'selected="selected"'; ?> >28</option>
  235. <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_start == 29)) echo 'selected="selected"'; ?> >29</option>
  236. <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_start == 30)) echo 'selected="selected"'; ?> >30</option>
  237. <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_start == 31)) echo 'selected="selected"'; ?> >31</option>
  238. </select>
  239. /
  240. <select name="month_start">
  241. <option value="1">01</option>
  242. <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_start == 2)) echo 'selected="selected"'; ?> >02</option>
  243. <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_start == 3)) echo 'selected="selected"'; ?> >03</option>
  244. <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_start == 4)) echo 'selected="selected"'; ?> >04</option>
  245. <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_start == 5)) echo 'selected="selected"'; ?> >05</option>
  246. <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_start == 6)) echo 'selected="selected"'; ?> >06</option>
  247. <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_start == 7)) echo 'selected="selected"'; ?> >07</option>
  248. <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_start == 8)) echo 'selected="selected"'; ?> >08</option>
  249. <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_start == 9)) echo 'selected="selected"'; ?> >09</option>
  250. <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_start == 10)) echo 'selected="selected"'; ?> >10</option>
  251. <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_start == 11)) echo 'selected="selected"'; ?> >11</option>
  252. <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_start == 12)) echo 'selected="selected"'; ?> >12</option>
  253. </select>
  254. /
  255. <select name="year_start">
  256. <?php
  257. for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
  258. ?>
  259. <option value="<?php echo $i; ?>" <?php if((!$formSent && $thisYear == $i) || ($formSent && $year_start == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  260. <?php
  261. }
  262. ?>
  263. </select>
  264. </div>
  265. </div>
  266. </div>
  267. <div class="control-group">
  268. <div class="controls">
  269. <label for="end_limit">
  270. <input id="end_limit" type="checkbox" name="end_limit" onchange="disable_endtime(this)" />
  271. <?php echo get_lang('DateEndSession') ?>
  272. </label>
  273. <div id="end_date" style="display:none">
  274. <br />
  275. <select name="day_end">
  276. <option value="1">01</option>
  277. <option value="2" <?php if((!$formSent && $thisDay == 2) || ($formSent && $day_end == 2)) echo 'selected="selected"'; ?> >02</option>
  278. <option value="3" <?php if((!$formSent && $thisDay == 3) || ($formSent && $day_end == 3)) echo 'selected="selected"'; ?> >03</option>
  279. <option value="4" <?php if((!$formSent && $thisDay == 4) || ($formSent && $day_end == 4)) echo 'selected="selected"'; ?> >04</option>
  280. <option value="5" <?php if((!$formSent && $thisDay == 5) || ($formSent && $day_end == 5)) echo 'selected="selected"'; ?> >05</option>
  281. <option value="6" <?php if((!$formSent && $thisDay == 6) || ($formSent && $day_end == 6)) echo 'selected="selected"'; ?> >06</option>
  282. <option value="7" <?php if((!$formSent && $thisDay == 7) || ($formSent && $day_end == 7)) echo 'selected="selected"'; ?> >07</option>
  283. <option value="8" <?php if((!$formSent && $thisDay == 8) || ($formSent && $day_end == 8)) echo 'selected="selected"'; ?> >08</option>
  284. <option value="9" <?php if((!$formSent && $thisDay == 9) || ($formSent && $day_end == 9)) echo 'selected="selected"'; ?> >09</option>
  285. <option value="10" <?php if((!$formSent && $thisDay == 10) || ($formSent && $day_end == 10)) echo 'selected="selected"'; ?> >10</option>
  286. <option value="11" <?php if((!$formSent && $thisDay == 11) || ($formSent && $day_end == 11)) echo 'selected="selected"'; ?> >11</option>
  287. <option value="12" <?php if((!$formSent && $thisDay == 12) || ($formSent && $day_end == 12)) echo 'selected="selected"'; ?> >12</option>
  288. <option value="13" <?php if((!$formSent && $thisDay == 13) || ($formSent && $day_end == 13)) echo 'selected="selected"'; ?> >13</option>
  289. <option value="14" <?php if((!$formSent && $thisDay == 14) || ($formSent && $day_end == 14)) echo 'selected="selected"'; ?> >14</option>
  290. <option value="15" <?php if((!$formSent && $thisDay == 15) || ($formSent && $day_end == 15)) echo 'selected="selected"'; ?> >15</option>
  291. <option value="16" <?php if((!$formSent && $thisDay == 16) || ($formSent && $day_end == 16)) echo 'selected="selected"'; ?> >16</option>
  292. <option value="17" <?php if((!$formSent && $thisDay == 17) || ($formSent && $day_end == 17)) echo 'selected="selected"'; ?> >17</option>
  293. <option value="18" <?php if((!$formSent && $thisDay == 18) || ($formSent && $day_end == 18)) echo 'selected="selected"'; ?> >18</option>
  294. <option value="19" <?php if((!$formSent && $thisDay == 19) || ($formSent && $day_end == 19)) echo 'selected="selected"'; ?> >19</option>
  295. <option value="20" <?php if((!$formSent && $thisDay == 20) || ($formSent && $day_end == 20)) echo 'selected="selected"'; ?> >20</option>
  296. <option value="21" <?php if((!$formSent && $thisDay == 21) || ($formSent && $day_end == 21)) echo 'selected="selected"'; ?> >21</option>
  297. <option value="22" <?php if((!$formSent && $thisDay == 22) || ($formSent && $day_end == 22)) echo 'selected="selected"'; ?> >22</option>
  298. <option value="23" <?php if((!$formSent && $thisDay == 23) || ($formSent && $day_end == 23)) echo 'selected="selected"'; ?> >23</option>
  299. <option value="24" <?php if((!$formSent && $thisDay == 24) || ($formSent && $day_end == 24)) echo 'selected="selected"'; ?> >24</option>
  300. <option value="25" <?php if((!$formSent && $thisDay == 25) || ($formSent && $day_end == 25)) echo 'selected="selected"'; ?> >25</option>
  301. <option value="26" <?php if((!$formSent && $thisDay == 26) || ($formSent && $day_end == 26)) echo 'selected="selected"'; ?> >26</option>
  302. <option value="27" <?php if((!$formSent && $thisDay == 27) || ($formSent && $day_end == 27)) echo 'selected="selected"'; ?> >27</option>
  303. <option value="28" <?php if((!$formSent && $thisDay == 28) || ($formSent && $day_end == 28)) echo 'selected="selected"'; ?> >28</option>
  304. <option value="29" <?php if((!$formSent && $thisDay == 29) || ($formSent && $day_end == 29)) echo 'selected="selected"'; ?> >29</option>
  305. <option value="30" <?php if((!$formSent && $thisDay == 30) || ($formSent && $day_end == 30)) echo 'selected="selected"'; ?> >30</option>
  306. <option value="31" <?php if((!$formSent && $thisDay == 31) || ($formSent && $day_end == 31)) echo 'selected="selected"'; ?> >31</option>
  307. </select>
  308. /
  309. <select name="month_end">
  310. <option value="1">01</option>
  311. <option value="2" <?php if((!$formSent && $thisMonth == 2) || ($formSent && $month_end == 2)) echo 'selected="selected"'; ?> >02</option>
  312. <option value="3" <?php if((!$formSent && $thisMonth == 3) || ($formSent && $month_end == 3)) echo 'selected="selected"'; ?> >03</option>
  313. <option value="4" <?php if((!$formSent && $thisMonth == 4) || ($formSent && $month_end == 4)) echo 'selected="selected"'; ?> >04</option>
  314. <option value="5" <?php if((!$formSent && $thisMonth == 5) || ($formSent && $month_end == 5)) echo 'selected="selected"'; ?> >05</option>
  315. <option value="6" <?php if((!$formSent && $thisMonth == 6) || ($formSent && $month_end == 6)) echo 'selected="selected"'; ?> >06</option>
  316. <option value="7" <?php if((!$formSent && $thisMonth == 7) || ($formSent && $month_end == 7)) echo 'selected="selected"'; ?> >07</option>
  317. <option value="8" <?php if((!$formSent && $thisMonth == 8) || ($formSent && $month_end == 8)) echo 'selected="selected"'; ?> >08</option>
  318. <option value="9" <?php if((!$formSent && $thisMonth == 9) || ($formSent && $month_end == 9)) echo 'selected="selected"'; ?> >09</option>
  319. <option value="10" <?php if((!$formSent && $thisMonth == 10) || ($formSent && $month_end == 10)) echo 'selected="selected"'; ?> >10</option>
  320. <option value="11" <?php if((!$formSent && $thisMonth == 11) || ($formSent && $month_end == 11)) echo 'selected="selected"'; ?> >11</option>
  321. <option value="12" <?php if((!$formSent && $thisMonth == 12) || ($formSent && $month_end == 12)) echo 'selected="selected"'; ?> >12</option>
  322. </select>
  323. /
  324. <select name="year_end">
  325. <?php
  326. for ($i=$thisYear-5;$i <= ($thisYear+5);$i++) {
  327. ?>
  328. <option value="<?php echo $i; ?>" <?php if((!$formSent && ($thisYear+1) == $i) || ($formSent && $year_end == $i)) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
  329. <?php
  330. }
  331. ?>
  332. </select>
  333. <br /> <br />
  334. <?php echo get_lang('SessionVisibility') ?>
  335. <select name="session_visibility" style="width:250px;">
  336. <?php
  337. $visibility_list = array(SESSION_VISIBLE_READ_ONLY=>get_lang('SessionReadOnly'), SESSION_VISIBLE=>get_lang('SessionAccessible'), SESSION_INVISIBLE=>api_ucfirst(get_lang('SessionNotAccessible')));
  338. foreach($visibility_list as $key=>$item): ?>
  339. <option value="<?php echo $key; ?>" <?php if($item == $visibility_id) echo 'selected="selected"'; ?>><?php echo $item; ?></option>
  340. <?php endforeach; ?>
  341. </select>
  342. </div>
  343. </div>
  344. </div>
  345. <div class="control-group">
  346. <div class="controls">
  347. <button class="save" type="submit" value="<?php echo get_lang('NextStep') ?>"><?php echo get_lang('NextStep') ?></button>
  348. </div>
  349. </div>
  350. </form>
  351. <script type="text/javascript">
  352. function setDisable(select){
  353. document.form.day_start.disabled = (select.checked) ? true : false;
  354. document.form.month_start.disabled = (select.checked) ? true : false;
  355. document.form.year_start.disabled = (select.checked) ? true : false;
  356. document.form.day_end.disabled = (select.checked) ? true : false;
  357. document.form.month_end.disabled = (select.checked) ? true : false;
  358. document.form.year_end.disabled = (select.checked) ? true : false;
  359. document.form.session_visibility.disabled = (select.checked) ? true : false;
  360. document.form.session_visibility.selectedIndex = 0;
  361. document.form.start_limit.disabled = (select.checked) ? true : false;
  362. document.form.start_limit.checked = false;
  363. document.form.end_limit.disabled = (select.checked) ? true : false;
  364. document.form.end_limit.checked = false;
  365. var end_div = document.getElementById('end_date');
  366. end_div.style.display = 'none';
  367. var start_div = document.getElementById('start_date');
  368. start_div.style.display = 'none';
  369. }
  370. function disable_endtime(select) {
  371. var end_div = document.getElementById('end_date');
  372. if (end_div.style.display == 'none')
  373. end_div.style.display = 'block';
  374. else
  375. end_div.style.display = 'none';
  376. }
  377. function disable_starttime(select) {
  378. var start_div = document.getElementById('start_date');
  379. if (start_div.style.display == 'none')
  380. start_div.style.display = 'block';
  381. else
  382. start_div.style.display = 'none';
  383. }
  384. </script>
  385. <?php
  386. Display::display_footer();