Ejemplo n.º 1
0
        // insert the entry into the database.
        if (addMorbidityEntry($_SESSION['mid'], $_REQUEST['morb_type'], $entryDate)) {
            $success_message = _("Health issue entry added successfully");
        } else {
            $error_message = _("An error ocurred while processing your submission. Please contact the site administrator.");
        }
    }
    if (isset($_REQUEST['callback'])) {
        $callback = $_REQUEST['callback'];
        // jsonp request
        $jsonp = true;
        header('Content-Type: text/javascript');
    } else {
        $callback = false;
        $jsonp = false;
        header('Content-Type: application/json');
    }
    processNotifications();
    $reply = array();
    if ($error_message) {
        $reply['error'] = $error_message;
    }
    if ($success_message) {
        $reply['message'] = $success_message;
    }
    $response = json_encode($reply);
    if ($jsonp) {
        $response = $_REQUEST['callback'] . '(' . $response . ')';
    }
    echo $response;
}
Ejemplo n.º 2
0
function displayNotification()
{
    include_once "includes/mail.include.php";
    processNotifications();
    $id = isset($_SESSION['sid']) ? $_SESSION['sid'] : $_SESSION['mid'];
    $scientist = isset($_SESSION['sid']);
    // find the number of unread notifications
    $notifications = getNotificationCount($id, $scientist);
    // find the number of unread messages;
    $unreadMessages = getMessageCount($id, $scientist)['unread'];
    if ($notifications > 0 || $unreadMessages > 0) {
        echo "<div id='warnmessage'>\n";
        if ($notifications > 0) {
            echo "" . _("Attention: You have") . " {$notifications} " . _("new notifications") . ". <a href='notifications.php'> " . _("View") . "</a>.<br>";
        }
        if ($unreadMessages > 0) {
            echo "" . _("Attention: You have") . " {$unreadMessages} " . _("new messages") . ". <a href='inbox.php'> " . _("View") . "</a>.<br>";
        }
        echo "</div>\n";
        echo "<br />\n";
    }
    $query = "UPDATE Notifications SET status = 1 WHERE status = 0 AND mid = " . $_SESSION['mid'] . ";";
    $result = mysql_query($query);
}