// TODO: al posto di $practitioner_proposal['mittente'] passare $tutorObj->getFullname() $text = sprintf(translateFN('Provider: "%s".%sService: "%s".%s'), $tester_name, $newline, $service_name, $newline) . ' ' . sprintf(translateFN("L'appuntamento con l'utente %s, in data %s alle ore %s, è stato inserito correttamente."), $tutorObj->getFullName(), $date, $time); } $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 ERR_3'))); } /* * SE NON SI SONO VERIFICATI ERRORI NELL'INVIO DELLA RISPOSTA AL TUTOR, * POSSO MARCARE COME ELIMINATO IL MESSAGGIO RELATIVO ALLA PROPOSTA DEL PRACTITIONER */ MultiPort::removeUserAppointments($userObj, array($msg_id)); $form = CommunicationModuleHtmlLib::getOperationWasSuccessfullView($text); } elseif (isset($_GET['err_msg'])) { $error_message = translateFN('An error occurred while processing your request, please try again later.') . '<br />' . translateFN('If the problem persists, please contact the administrator.'); $form = CommunicationModuleHtmlLib::getOperationWasSuccessfullView($error_message); } else { if (isset($msg_id)) { $data = MultiPort::getUserAppointment($userObj, $msg_id); $_SESSION['practitioner_proposal'] = $data; $_SESSION['event_msg_id'] = $msg_id; /* * Check if the user has already an appointment in one of the proposed dates * or if an appointment proposal is in the past. */ $datetimesAr = ADAEventProposal::extractDateTimesFromEventProposalText($data['testo']); if ($datetimesAr === FALSE) { $errObj = new ADA_Error(NULL, translateFN("Errore nell'ottenimento delle date per l'appuntamento")); } /* * Obtain a messagehandler instance for the correct tester
$admList = $common_dh->get_users_by_type($admtypeAr); if (!AMA_DataHandler::isError($admList)) { $adm_uname = $admList[0]['username']; } else { $adm_uname = ""; // ??? FIXME: serve un superadmin nel file di config? } $clean_subject = ADAEventProposal::removeEventToken($subject); $message_content = sprintf(translateFN('Dear user, the practitioner %s has sent you new proposal dates for the appointment: %s.'), $userObj->getFullName(), $clean_subject); $message_ha = array('tipo' => ADA_MSG_MAIL, 'mittente' => $adm_uname, 'destinatari' => array($addresseeObj->username), 'data_ora' => 'now', 'titolo' => 'ADA: ' . translateFN('new event proposal dates'), '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'))); } $text = translateFN("La proposta di appuntamento è stata inviata con successo all'utente ") . $addresseeObj->getFullName() . "."; $form = CommunicationModuleHtmlLib::getOperationWasSuccessfullView($text); //header('Location: '.HTTP_ROOT_DIR.'/comunica/list_events.php'); //exit(); } } else { if (isset($msg_id)) { $data = MultiPort::getUserAppointment($userObj, $msg_id); if ($data['flags'] & ADA_EVENT_PROPOSAL_OK) { /* * The user accepted one of the three proposed dates for the appointment. * E' UN CASO CHE NON SI PUO' VERIFICARE, visto che vogliamo che l'appuntamento * venga inserito non appena l'utente accetta una data porposta dal practitioner */ $form = CommunicationModuleHtmlLib::getConfirmedEventProposalForm($data); } else { /*