$result = $dh->course_instance_tutor_subscribe($courseInstanceId, $id_tutor_new); if (AMA_DataHandler::isError($result)) { $errObj = new ADA_Error($result, translateFN('Errore durante assegnazione del practitioner al client')); } else { /* * For each course instance, a class chatroom with the same duration * is made available. Every time there is an update in the course instance * duration, this chatroom needs to be updated too. */ $id_instance = $courseInstanceId; /* * $start_time = $start_date; $end_time = $dh->add_number_of_days($_POST['durata'],$start_time); // $end_time = $course_instance_data_before_update['data_fine']; */ $id_chatroom = ChatRoom::get_class_chatroom_for_instance($id_instance, 'C'); if (!AMA_DataHandler::isError($id_chatroom)) { /* * An existing chatroom with id class and type = C (chat classroom) * already exists, so update this chatroom owner (= tutor id). */ $chatroomObj = new Chatroom($id_chatroom); $chatroom_data['id_chat_owner'] = $id_tutor_new; $result = $chatroomObj->set_chatroomFN($chatroomObj->id_chatroom, $chatroom_data); if (AMA_DataHandler::isError($result)) { // gestire l'errore } } } } header('Location: list_instances.php?id_course=' . $courseId);