|
|
|
@ -1887,7 +1887,8 @@ class SessionManager |
|
|
|
|
$extraFieldId = null, |
|
|
|
|
$daysCoachAccessBeforeBeginning = null, |
|
|
|
|
$daysCoachAccessAfterBeginning = null, |
|
|
|
|
$sessionVisibility = 1 |
|
|
|
|
$sessionVisibility = 1, |
|
|
|
|
$fieldsToAvoidUpdate = array() |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
$content = file($file); |
|
|
|
@ -2045,7 +2046,7 @@ class SessionManager |
|
|
|
|
date_start = '$date_start', |
|
|
|
|
date_end = '$date_end', |
|
|
|
|
visibility = '$visibility', |
|
|
|
|
session_category_id = '$session_category_id'".$extraParameters; |
|
|
|
|
session_category_id = '$session_category_id' ".$extraParameters; |
|
|
|
|
|
|
|
|
|
Database::query($sql_session); |
|
|
|
|
// We get the last insert id. |
|
|
|
@ -2066,30 +2067,28 @@ class SessionManager |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
$params = array( |
|
|
|
|
'id_coach' => $coach_id, |
|
|
|
|
'date_start' => $date_start, |
|
|
|
|
'date_end' => $date_end, |
|
|
|
|
'visibility' => $visibility, |
|
|
|
|
'session_category_id' => $session_category_id |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($fieldsToAvoidUpdate)) { |
|
|
|
|
foreach ($fieldsToAvoidUpdate as $field) { |
|
|
|
|
unset($params[$field]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($sessionId) && !empty($sessionId)) { |
|
|
|
|
// The session already exists, update it then. |
|
|
|
|
$sql_session = "UPDATE $tbl_session SET |
|
|
|
|
id_coach = '$coach_id', |
|
|
|
|
date_start = '$date_start', |
|
|
|
|
date_end = '$date_end', |
|
|
|
|
visibility = '$visibility', |
|
|
|
|
session_category_id = '$session_category_id' |
|
|
|
|
WHERE id = '$sessionId'"; |
|
|
|
|
//name = '$session_name' |
|
|
|
|
Database::query($sql_session); |
|
|
|
|
Database::update($tbl_session, $params, array('id = ?' => $sessionId)); |
|
|
|
|
$session_id = $sessionId; |
|
|
|
|
} else { |
|
|
|
|
Database::update($tbl_session, $params, array("name = '?' " => $session_name)); |
|
|
|
|
|
|
|
|
|
// The session already exists, update it then. |
|
|
|
|
$sql_session = "UPDATE $tbl_session SET |
|
|
|
|
id_coach = '$coach_id', |
|
|
|
|
date_start = '$date_start', |
|
|
|
|
date_end = '$date_end', |
|
|
|
|
visibility = '$visibility', |
|
|
|
|
session_category_id = '$session_category_id' |
|
|
|
|
WHERE name = '$session_name'"; |
|
|
|
|
Database::query($sql_session); |
|
|
|
|
$row = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'"); |
|
|
|
|
$row = Database::query("SELECT id FROM $tbl_session WHERE name = '$session_name'"); |
|
|
|
|
list($session_id) = Database::fetch_array($row); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|