$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; $appointment_title = ADAEventProposal::removeEventToken($subject); $appointment_message = sprintf(translateFN('Provider: "%s".%sService: "%s".%s'), $tester_name, $newline, $service_name, $newline) . ' ' . sprintf(translateFN('This is a reminder for the appointment %s: %s in date %s at time %s'), $appointment_title, $appointment_type, $date, $time); $practitioner_email_message_ha = array('tipo' => ADA_MSG_MAIL, 'mittente' => $adm_uname, 'destinatari' => array($practitioner_proposal['mittente']), 'data_ora' => 'now', 'titolo' => 'ADA: ' . translateFN('appointment reminder'), 'testo' => $appointment_message); $user_email_message_ha = array('tipo' => ADA_MSG_MAIL, 'mittente' => $adm_uname, 'destinatari' => array($user_uname), 'data_ora' => 'now', 'titolo' => 'ADA: ' . translateFN('appointment reminder'), 'testo' => $appointment_message); /* * Send the email message to the practitioner */ $res = $mh->send_message($practitioner_email_message_ha); if (AMA_DataHandler::isError($res)) {
if (($value = ADAEventProposal::canProposeThisDateTime($userObj, $date3, $time3, $sess_selected_tester)) !== TRUE) { $errors['date3'] = $value; } $datetimesAr = array(array('date' => $date1, 'time' => $time1), array('date' => $date2, 'time' => $time2), array('date' => $date3, 'time' => $time3)); $message_content = ADAEventProposal::generateEventProposalMessageContent($datetimesAr, $id_course_instance, $notes); if (count($errors) > 0) { $data = array('testo' => $message_content, 'titolo' => $subject, 'flags' => $type); $form = CommunicationModuleHtmlLib::getEventProposalForm($id_user, $data, $errors, $sess_selected_tester); } else { /* * If we are ready to send the message, we can safely unset $_SESSION['event_msg_id']) */ unset($_SESSION['event_msg_id']); $mh = MessageHandler::instance(MultiPort::getDSN($sess_selected_tester)); $addresseeObj = MultiPort::findUser($id_user); $message_ha = array('tipo' => ADA_MSG_AGENDA, 'flags' => ADA_EVENT_PROPOSED | $type, 'mittente' => $user_uname, 'destinatari' => array($addresseeObj->username), 'data_ora' => 'now', 'titolo' => ADAEventProposal::addEventToken($event_token, $subject), 'testo' => $message_content); $res = $mh->send_message($message_ha); if (AMA_DataHandler::isError($res)) { $errObj = new ADA_Error($res, translateFN('Impossibile spedire il messaggio'), NULL, NULL, NULL, $error_page . '?err_msg=' . urlencode(translateFN('Impossibile spedire il messaggio'))); } /* * If there aren't errors, redirect the user to his agenda */ /* * SE ABBIAMO INVIATO UNA MODIFICA AD UNA PROPOSTA DI APPUNTAMENTO, * LA PROPOSTA PRECEDENTE DEVE ESSERE MARCATA COME CANCELLATA IN * DESTINATARI MESSAGGI PER L'UTENTE PRACTITIONER */ if (isset($previous_proposal_msg_id)) { MultiPort::removeUserAppointments($userObj, array($previous_proposal_msg_id)); }