|
@@ -1032,7 +1032,10 @@ class ImportCsv
|
|
|
$this->logger->addInfo("external_sessionID: ".$externalSessionId." does not exists.");
|
|
|
}
|
|
|
$teacherId = null;
|
|
|
+ $sessionInfo = [];
|
|
|
if (!empty($sessionId) && !empty($courseInfo)) {
|
|
|
+ $sessionInfo = api_get_session_info($sessionId);
|
|
|
+
|
|
|
$courseIncluded = SessionManager::relation_session_course_exist(
|
|
|
$sessionId,
|
|
|
$courseInfo['real_id']
|
|
@@ -1054,7 +1057,6 @@ class ImportCsv
|
|
|
$teacher = current($teachers);
|
|
|
$teacherId = $teacher['user_id'];
|
|
|
} else {
|
|
|
- $sessionInfo = api_get_session_info($sessionId);
|
|
|
$teacherId = $sessionInfo['id_coach'];
|
|
|
}
|
|
|
}
|
|
@@ -1090,6 +1092,21 @@ class ImportCsv
|
|
|
$errorFound = true;
|
|
|
}
|
|
|
|
|
|
+ // Check session dates
|
|
|
+ if ($sessionInfo && !empty($sessionInfo['access_start_date'])) {
|
|
|
+ $date = new \DateTime($sessionInfo['access_start_date']);
|
|
|
+ $interval = new \DateInterval('P7D');
|
|
|
+ $date->sub($interval);
|
|
|
+ if ($date->getTimestamp() > time()) {
|
|
|
+ $this->logger->addInfo(
|
|
|
+ "Calendar event # ".$row['external_calendar_itemID']."
|
|
|
+ in session [$externalSessionId] was not added
|
|
|
+ because the startdate is more than 7 days in the future: ".$sessionInfo['access_start_date']
|
|
|
+ );
|
|
|
+ $errorFound = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ($errorFound == false) {
|
|
|
$eventsToCreate[] = [
|
|
|
'start' => $startDate,
|