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