$self = whoami(); include_once 'include/comunica_functions.inc.php'; include_once 'include/ADAEvent.inc.php'; /* * YOUR CODE HERE */ if ($id_course) { $sess_id_course = $id_course; } if (isset($id_course_instance)) { $sess_id_course_instance = $id_course_instance; } else { $sess_id_course_instance = null; } if (isset($del_msg_id) and !empty($del_msg_id)) { $res = MultiPort::removeUserAppointments($userObj, array($del_msg_id)); if (AMA_DataHandler::isError($res)) { $errObj = new ADA_Error($res, translateFN('Errore durante la cancellazione di un evento'), NULL, NULL, NULL, 'comunica/list_events.php?status=' . urlencode(translateFN('Errore durante la cancellazione'))); } else { $status = translateFN('Cancellazione eseguita'); header("Location: list_events.php?status={$status}"); exit; } } /* * Obtain a messagehandler instance for the correct tester */ if (MultiPort::isUserBrowsingThePublicTester()) { /* * In base a event_msg_id, ottenere connessione al tester appropriato */
$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)); } /* * Inviamo una mail all'utente in cui lo informiamo del fatto che il * practitioner ha inviato delle nuove proposte */ $admtypeAr = array(AMA_TYPE_ADMIN); $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);