Exemple #1
0
function prepare_message_review($dbh, $req_id)
{
    $_SESSION['requestid'] = $req_id;
    /* In order to display the message review screen, we need to first get the request record.  Then the
     * account ID is used to log into the Bronto API to extract other message-oriented information.
     */
    $reqinfo = db_load_request($dbh, $req_id);
    if ($reqinfo != null) {
        $acctid = $reqinfo['account_id'];
        $login_info = bronto_agency_login($acctid);
        if ($login_info) {
            $bapi = $login_info['binding'];
            $session_id = $login_info['sessionID'];
            $_SESSION['session_id'] = $session_id;
            $username = $_SESSION['username'];
            $rc = db_save_session($dbh, $session_id, $username, $acctid);
            if ($rc == false) {
                display_warnbox("Unable to save session information (id=" . $session_id . ",user="******")");
            }
            print_message_review_form($bapi, $session_id, $reqinfo);
            if (db_update_request_status($dbh, $req_id, "UNDER_REVIEW") == false) {
                display_warnbox("Unable to update request status.");
            }
        } else {
            display_errorbox("Unable to contact the Bronto API server.");
            print_requestid_form($req_id);
        }
    } else {
        display_errorbox("Request ID " . $req_id . " is invalid.");
        print_requestid_form($req_id);
    }
}
Exemple #2
0
        $key_field = 'username';
        $key_value = $_POST['username'];
        if ($key_value != 'reviewer1') {
            $result = db_get_records($dbh, $table_name, $key_field, $key_value, $sortby = null);
            if ($result != null) {
                $to_addr = $result[0]['email'];
                $to_name = $result[0]['firstname'] . ' ' . $result[0]['lastname'];
                $key_value = $_POST['fm_username'];
                $result = db_get_records($dbh, $table_name, $key_field, $key_value, $sortby = null);
                $from_addr = $result[0]['email'];
                $from_name = $result[0]['firstname'] . ' ' . $result[0]['lastname'];
                $cc_addrs = array();
                $subject = 'Message with request ID# ' . $fm_requestid . ' is reassigned to you.';
                $url_str = get_review_url($fm_requestid);
                $body = "Hello " . $to_name . "!\n\n" . "{$from_name} has assigned a T-Reqs email approval request to you, for the email titled " . $result_message[0]['message_name'] . ".\n\n" . "Please use the link below to sign into the T-Reqs website, review the message, and either approve or reject it based on Senate guidelines." . ".\n\n" . "    {$url_str}\n\n\n" . "Please reference the information provided below " . "with technical questions.\n\n" . "Request Details:\n" . "    Request ID: {$fm_requestid}\n" . "    Message Name: " . $result_message[0]['message_name'] . "\n" . "    Site Name: " . $result_message[0]['account_name'] . "\n\n" . "\n\n\n" . "Sincerely,\n\n" . "{$from_name}\n" . "(via " . APP_NAME . ")\n\n";
                send_email_message($from_addr, $from_name, $to_addr, $to_name, $cc_addrs, $subject, $body);
            }
        }
    } else {
        $result = db_get_records($dbh, "request", "uuid", $fm_requestid, $sortby = null);
        db_update_request_status_user($dbh, $fm_requestid, $result[0]['status'], $result[0]['request_notes'], $result[0]['reviewer']);
    }
    include 'display_listrequest.php';
    //AB //show request list
    print_requestid_form();
} else {
    print '<h2>T-Reqs blast e-mail message ID# ' . $fm_requestid . ' to be either reassigned to a different reviewer or to a different status.</h2>';
    print '<h2>To put it back to the queue, just choose Default Reviewer and Awaiting Review otherwise choose a reviewer and Under Review to reassign.</h2>';
    review_re_assign_form($dbh, 'user', 'role', 'REVIEWER', $fm_requestid);
    //build the reassign <form>
}