'index.php',"name" => get_lang('PlatformAdmin')); $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=get_lang('DateStartMoreThanDateEnd'); else { $rs = api_sql_query("SELECT id FROM $tbl_session WHERE name='".addslashes($name)."'"); $exists = false; while($row = mysql_fetch_array($rs)){ if($row['id']!=$id) $exists = true; } if($exists){ $errorMsg = get_lang('SessionNameSoonExists'); } else { api_sql_query("UPDATE $tbl_session SET name='".addslashes($name)."', date_start='$date_start', date_end='$date_end', id_coach='$id_coach' WHERE id='$id'",__FILE__,__LINE__); header('Location: resume_session?id_session='.$id); exit(); } } } else { $result=api_sql_query("SELECT name,date_start,date_end,id_coach FROM $tbl_session WHERE id='$id'",__FILE__,__LINE__); if(!$infos=mysql_fetch_array($result)) { header('Location: session_list.php'); exit(); } list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']); list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']); } $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'); Display::display_header($tool_name); api_display_tool_title($tool_name); ?>