Ejemplo n.º 1
0
 /**
  * @param string $file
  * @param bool   $moveFile
  * @param array $teacherBackup
  * @param array $groupBackup
  */
 private function importSessions($file, $moveFile = true, &$teacherBackup = array(), &$groupBackup = array())
 {
     $avoid = null;
     if (isset($this->conditions['importSessions']) && isset($this->conditions['importSessions']['update'])) {
         $avoid = $this->conditions['importSessions']['update'];
     }
     $result = SessionManager::importCSV($file, true, $this->defaultAdminId, $this->logger, array('SessionID' => 'extra_' . $this->extraFieldIdNameList['session']), $this->extraFieldIdNameList['session'], $this->daysCoachAccessBeforeBeginning, $this->daysCoachAccessAfterBeginning, $this->defaultSessionVisibility, $avoid, false, false, true, true, true, 1, $teacherBackup, $groupBackup);
     if (!empty($result['error_message'])) {
         $this->logger->addError($result['error_message']);
     }
     $this->logger->addInfo("Sessions - Sessions parsed: " . $result['session_counter']);
     if ($moveFile) {
         $this->moveFile($file);
     }
 }
Ejemplo n.º 2
0
                         $error_message .= get_lang('CourseDoesNotExist').' : '.$course_code.'<br />';
                     }
                     */
                 }
                 Database::query("UPDATE {$tbl_session} SET nbr_users='{$user_counter}', nbr_courses='{$course_counter}' WHERE id='{$session_id}'");
             }
         }
         if (empty($root->Users->User) && empty($root->Courses->Course) && empty($root->Session)) {
             $error_message = get_lang('NoNeededData');
         }
     } else {
         $error_message .= get_lang('XMLNotValid');
     }
 } else {
     // CSV
     $result = SessionManager::importCSV($_FILES['import_file']['tmp_name'], $updatesession, api_get_user_id());
     $error_message = $result['error_message'];
     $session_counter = $result['session_counter'];
 }
 if (!empty($error_message)) {
     $error_message = get_lang('ButProblemsOccured') . ' :<br />' . $error_message;
 }
 if (count($inserted_in_course) > 1) {
     $warn = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode') . ': ';
     foreach ($inserted_in_course as $code => $title) {
         $warn .= ' ' . $title . ' (' . $code . '),';
     }
     $warn = substr($warn, 0, -1);
 }
 if ($session_counter == 1) {
     header('Location: resume_session.php?id_session=' . $session_id . '&warn=' . urlencode($warn));
Ejemplo n.º 3
0
                     }
                 }
                 Database::query("UPDATE {$tbl_session} SET nbr_users='{$user_counter}', nbr_courses='{$course_counter}' WHERE id='{$session_id}'");
             }
         }
         if (empty($root->Users->User) && empty($root->Courses->Course) && empty($root->Session)) {
             $error_message = get_lang('NoNeededData');
         }
     } else {
         $error_message .= get_lang('XMLNotValid');
     }
 } else {
     // CSV
     $updateCourseCoaches = isset($_POST['update_course_coaches']) ? true : false;
     $addOriginalCourseTeachersAsCourseSessionCoaches = isset($_POST['add_me_as_coach']) ? true : false;
     $result = SessionManager::importCSV($_FILES['import_file']['tmp_name'], $isOverwrite, api_get_user_id(), null, array(), null, null, null, 1, array(), $deleteUsersNotInList, $updateCourseCoaches, false, $addOriginalCourseTeachersAsCourseSessionCoaches, false);
     $sessionList = $result['session_list'];
     $error_message = $result['error_message'];
     $session_counter = $result['session_counter'];
 }
 if (!empty($error_message)) {
     $error_message = get_lang('ButProblemsOccured') . ' :<br />' . $error_message;
 }
 if (count($inserted_in_course) > 1) {
     $warn = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode') . ': ';
     foreach ($inserted_in_course as $code => $title) {
         $warn .= ' ' . $title . ' (' . $code . '),';
     }
     $warn = substr($warn, 0, -1);
 }
 if ($session_counter == 1) {
Ejemplo n.º 4
0
                         $error_message .= get_lang('CourseDoesNotExist') . ' : ' . $course_code . '<br />';
                     }
                 }
                 Database::query("UPDATE {$tbl_session} SET nbr_users='{$user_counter}', nbr_courses='{$course_counter}' WHERE id='{$session_id}'");
             }
         }
         if (empty($root->Users->User) && empty($root->Courses->Course) && empty($root->Session)) {
             $error_message = get_lang('NoNeededData');
         }
     } else {
         $error_message .= get_lang('XMLNotValid');
     }
 } else {
     // CSV
     $updateCourseCoaches = isset($_POST['update_course_coaches']) ? true : false;
     $result = SessionManager::importCSV($_FILES['import_file']['tmp_name'], $isOverwrite, api_get_user_id(), null, array(), null, null, null, 1, array(), $deleteUsersNotInList, $updateCourseCoaches);
     $sessionList = $result['session_list'];
     $error_message = $result['error_message'];
     $session_counter = $result['session_counter'];
 }
 if (!empty($error_message)) {
     $error_message = get_lang('ButProblemsOccured') . ' :<br />' . $error_message;
 }
 if (count($inserted_in_course) > 1) {
     $warn = get_lang('SeveralCoursesSubscribedToSessionBecauseOfSameVisualCode') . ': ';
     foreach ($inserted_in_course as $code => $title) {
         $warn .= ' ' . $title . ' (' . $code . '),';
     }
     $warn = substr($warn, 0, -1);
 }
 if ($session_counter == 1) {