"index.php","name" => get_lang('AdministrationTools')); $interbreadcrumb[]=array("url" => "session_list.php","name" => get_lang('SessionList')); if($_POST['formSent']) { $formSent=1; $name=trim(stripslashes($_POST['name'])); $year_start=intval($_POST['year_start']); $month_start=intval($_POST['month_start']); $day_start=intval($_POST['day_start']); $year_end=intval($_POST['year_end']); $month_end=intval($_POST['month_end']); $day_end=intval($_POST['day_end']); $id_coach=intval($_POST['id_coach']); if(empty($_POST['nolimit'])){ $date_start="$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start); $date_end="$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end); } else { $date_start="000-00-00"; $date_end="000-00-00"; } if(empty($name)) $errorMsg=get_lang('SessionNameIsRequired'); elseif(empty($_POST['nolimit']) && (!$month_start || !$day_start || !$year_start || !checkdate($month_start,$day_start,$year_start))) $errorMsg="Veuillez introduire une date de début valide !"; elseif(empty($_POST['nolimit']) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end,$day_end,$year_end))) $errorMsg="Veuillez introduire une date de fin valide !"; elseif(empty($_POST['nolimit']) && $date_start >= $date_end) $errorMsg="La date de fin doit être postérieure à la date de début !"; else { $rs = api_sql_query("SELECT 1 FROM $tbl_session WHERE name='".addslashes($name)."'"); if(mysql_num_rows($rs)){ $errorMsg = get_lang('SessionNameSoonExists'); } else { api_sql_query("INSERT INTO $tbl_session(name,date_start,date_end,id_coach) VALUES('".addslashes($name)."','$date_start','$date_end','$id_coach')",__FILE__,__LINE__); $id_session=mysql_insert_id(); header('Location: add_courses_to_session.php?id_session='.$id_session.'&add=true'); exit(); } } } $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1' ORDER BY lastname,firstname,username"; $result=api_sql_query($sql,__FILE__,__LINE__); $Coaches=api_store_result($result); $thisYear=date('Y'); $thisMonth=date('m'); $thisDay=date('d'); Display::display_header($tool_name); api_display_tool_title($tool_name); ?>