'index.php','name' => get_lang('PlatformAdmin')); $interbreadcrumb[]=array('url' => 'session_list.php','name' => get_lang('SessionList')); // Database Table Definitions $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS); $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_class = Database::get_main_table(TABLE_MAIN_CLASS); $tbl_class_rel_user = Database::get_main_table(TABLE_MAIN_CLASS_USER); $id_session = (int)$_GET['id_session']; $sql = 'SELECT name, nbr_courses, nbr_users, nbr_classes, DATE_FORMAT(date_start,"%d-%m-%Y") as date_start, DATE_FORMAT(date_end,"%d-%m-%Y") as date_end, lastname, firstname, username, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end FROM '.$tbl_session.' LEFT JOIN '.$tbl_user.' ON id_coach = user_id WHERE '.$tbl_session.'.id='.$id_session; $rs = api_sql_query($sql, __FILE__, __LINE__); $session = api_store_result($rs); $session = $session[0]; if(!api_is_platform_admin() && $session['session_admin_id']!=$_user['user_id']) { api_not_allowed(true); } if($_GET['action'] == 'delete') { $idChecked = $_GET['idChecked']; if(is_array($idChecked)) { $idChecked="'".implode("','",$idChecked)."'"; api_sql_query("DELETE FROM $tbl_session_rel_course WHERE id_session='$id_session' AND course_code IN($idChecked)",__FILE__,__LINE__); $nbr_affected_rows=mysql_affected_rows(); api_sql_query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$id_session' AND course_code IN($idChecked)",__FILE__,__LINE__); api_sql_query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'",__FILE__,__LINE__); } if(!empty($_GET['class'])){ api_sql_query("DELETE FROM $tbl_session_rel_class WHERE session_id='$id_session' AND class_id=".$_GET['class'],__FILE__,__LINE__); $nbr_affected_rows=mysql_affected_rows(); api_sql_query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$id_session'",__FILE__,__LINE__); } if(!empty($_GET['user'])){ api_sql_query("DELETE FROM $tbl_session_rel_user WHERE id_session='$id_session' AND id_user=".$_GET['user'],__FILE__,__LINE__); $nbr_affected_rows=mysql_affected_rows(); api_sql_query("UPDATE $tbl_session SET nbr_users=nbr_users-$nbr_affected_rows WHERE id='$id_session'",__FILE__,__LINE__); api_sql_query("DELETE FROM $tbl_session_rel_course_rel_user WHERE id_session='$id_session' AND id_user=".$_GET['user'],__FILE__,__LINE__); $nbr_affected_rows=mysql_affected_rows(); api_sql_query("UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows WHERE id_session='$id_session'",__FILE__,__LINE__); } } Display::display_header($tool_name); api_display_tool_title($tool_name); ?>
: | |
: | |
: | |
: | |
: |