$message_text = sprintf(translateFN('Provider: "%s".%sService: "%s".%s'), $tester_name, $newline, $service_name, $newline); $message_text .= ' ' . sprintf(translateFN("L'appuntamento, di tipo %s, si terrà il giorno %s alle ore %s."), $new_subject, $date, $time); /** * In case the user is confirming a videochat or a chat appointment, * we will also add a link to enter the chat or videochat directly from the * appointment message. */ if (ADA_CHAT_EVENT & $practitioner_proposal['flags'] || ADA_VIDEOCHAT_EVENT & $practitioner_proposal['flags']) { if (ADA_CHAT_EVENT & $practitioner_proposal['flags']) { $event_flag = ADA_CHAT_EVENT; $end_time = $data_ora + $service_infoAr[7]; //durata_max_incontro $chatroom_ha = array('id_course_instance' => $course_instance, 'id_chat_owner' => $practitioner_proposal['id_mittente'], 'chat_title' => ADAEventProposal::addEventToken($event_token, $new_subject), 'chat_topic' => '', 'start_time' => $data_ora, 'end_time' => $end_time); require_once 'include/ChatDataHandler.inc.php'; require_once 'include/ChatRoom.inc.php'; $id_chatroom = ChatRoom::add_chatroomFN($chatroom_ha, $tester_dsn); if (AMA_DataHandler::isError($id_chatroom)) { $errObj = new ADA_Error($id_chatroom, translateFN("Si è verificato un errore nella creazione della chatroom. L'appuntamento non è stato creato."), NULL, NULL, NULL, $userObj->getHomePage()); } } else { $event_flag = ADA_VIDEOCHAT_EVENT; } $message_text .= ADAEvent::generateEventMessageAction($event_flag, $id_course, $course_instance); } $message_ha = array('tipo' => ADA_MSG_AGENDA, 'flags' => ADA_EVENT_CONFIRMED | $event_flag, 'mittente' => $user_uname, 'destinatari' => array($user_uname, $practitioner_proposal['mittente']), 'data_ora' => $data_ora, 'titolo' => ADAEventProposal::addEventToken($event_token, $new_subject), 'testo' => $message_text); /* * Here we send an email message as an appointment reminder. * We send it seprately to the user and to the practitioner, since we do not * want the user to know the practitioner's email address. */ $appointment_type = $new_subject;
$id_course = $dh->get_course_id_for_course_instance($id_instance); if (AMA_DataHandler::isError($id_course)) { // gestire l'errore } $course_data = $dh->get_course($id_course); if (AMA_DataHandler::isError($course_data)) { // gestire l'errore } $id_tutor = $dh->course_instance_tutor_get($id_instance); if (!AMA_DataHandler::isError($id_tutor)) { $chatroom_ha['id_chat_owner'] = $id_tutor; } else { $chatroom_ha['id_chat_owner'] = $sess_id_user; } $chatroom_ha = array('chat_title' => $course_data['titolo'], 'chat_topic' => translateFN('Discussione sui contenuti del corso'), 'start_time' => $start_time, 'end_time' => $end_time, 'max_utenti' => '999', 'id_course_instance' => $id_instance); $result = ChatRoom::add_chatroomFN($chatroom_ha); if (AMA_DataHandler::isError($result)) { // gestire l'errore } } else { // e' un errore, gestire } } else { /* * An existing chatroom with duration == class duration * already exists, so update this chatroom start and end time. */ $chatroomObj = new Chatroom($id_chatroom, MultiPort::getDSN($_SESSION['sess_selected_tester'])); $id_tutor = $dh->course_instance_tutor_get($id_instance); if (!AMA_DataHandler::isError($id_tutor)) { $chatroom_data['id_chat_owner'] = $id_tutor;