function grid_action() { // needed to hide the menu $dashboard_active = true; $messages = get_all_messages(); $events = get_google_calendar_events(); require 'templates/grid.php'; }
function display_messages($binding) { $messages = get_all_messages($binding); if ($messages) { echo "<messages count=\"" . count($messages) . "\">\n"; foreach ($messages as $message) { echo "<message id=\"" . $message->id . "\" name=\"" . $message->name . "\" status=\"" . $message->status . "\"/>\n"; } echo "</messages>\n"; } }
echo "<p>Welcome {$_SESSION['first_name']}!</p>"; ?> <form class="logout" action="process.php" method="post"> <input type="hidden" name="action" value="logout"> <input type="submit" name="logout" value="Logout!"> </form> </div> <div class="posts"> <h2>Post a message</h2> <form action="wall_process.php" method="post"> <textarea class="post" name="post"></textarea> <input type="hidden" name="action" value="post_message"> <input class="button" type="submit" name="post_message" value="Post a message"> </form> <?php get_all_messages(); foreach ($_SESSION["messages"] as $message) { $str_to_time = strtotime($message["created_at"]); $date = date("F jS Y", $str_to_time); get_all_comments($message['message_id']); // display messages echo "<p class='bold'>{$message['first_name']} {$message['last_name']} - {$date}</p>"; // display delete button if the message has been here less than 30 mins. // bug in this where if you don't refresh the page after 30min and the delete // button is still there then you can still delete, fix: add same check inside // wall_process.php to not allow deleting of row in DB if over 30min. if (round(abs(time() - $str_to_time) / 60) < 30) { // Delete message button echo "<form class='inline' action='wall_process.php' method='post'>"; echo "<input type='hidden' name='action' value='delete_message'>"; echo "<input type='hidden' name='message_id' value='{$message['message_id']}'>";
function print_message_select_form($bapi, $session_id, $msg_id = null, $list_ids = null, $seg_ids = null, $year = null, $month = null, $day = null, $from_addr = null, $from_name = null, $reply_addr = null) { // Use the API to retrieve messages, lists, and segments for client. if (!$bapi) { return false; } // The next 3 API calls will fail on the Agency account itself. $bapi must reference a subaccount. $messages = get_all_messages($bapi); $lists = get_all_lists($bapi); $segments = get_all_segments($bapi); ?> <h2><?php echo HEADER_REQUEST; ?> - Message Selection</h2> <form method="post" action="<?php echo REQUEST_SCRIPT; ?> "> <input type="hidden" name="fm_stage" value="select"/> <input type="hidden" name="fm_sessionid" value="<?php echo $session_id; ?> "/> <p> <label class="required">Please select the message to be approved:</label> </p> <?php if (count($messages) > 0) { ?> <select name="fm_msgid"> <option value="">Please select a message...</option> <?php foreach ($messages as $msg) { $sel_flag = $msg->id == $msg_id ? "selected" : ""; echo "<option value=\"{$msg->id}\" {$sel_flag}>{$msg->name}</option>\n"; } ?> </select> <?php } else { echo "<div class=\"warning\">There are no messages to select.</div>"; } ?> <p> <label class="required">Please select the list(s) and/or segment(s) to be targeted:</label> </p> <div id="list_seg_2_cols"> <?php echo "<div id=\"list_select\">\n<p><u>Lists</u></p>\n"; if (count($lists) > 0) { foreach ($lists as $list) { $chk_flag = $list_ids && in_array($list->id, $list_ids) ? "checked" : ""; echo "<input type=\"checkbox\" name=\"fm_listids[]\" value=\"{$list->id}\" {$chk_flag}/>{$list->name} [{$list->activeCount}]<br/>\n"; } } else { echo "<div class=\"warning\">There are no lists to select.</div>\n"; } echo "\n</div>\n<div id=\"segment_select\">\n<p><u>Segments</u></p>\n"; if (count($segments) > 0) { foreach ($segments as $segment) { $chk_flag = $seg_ids && in_array($segment->id, $seg_ids) ? "checked" : ""; echo "<input type=\"checkbox\" name=\"fm_segids[]\" value=\"{$segment->id}\" {$chk_flag}/>{$segment->name}<br/>\n"; } } else { echo "<div class=\"warning\">There are no segments to select.</div>\n"; } ?> </div> <div style="clear: both"></div> <p> Please enter the date on which the message should be sent: </p> <?php display_date_selector($year, $month, $day); ?> <p> Please enter message header information: </p> <p> <label class="required">From Address:</label> <input type="text" name="fm_fromaddr" value="<?php echo $from_addr; ?> "/> <label class="required">From Full Name:</label> <input type="text" name="fm_fromname" value="<?php echo $from_name; ?> "/> <label class="optional">Reply Address:</label> <input type="text" name="fm_replyaddr" value="<?php echo $reply_addr; ?> "/> </p> <p> <input type="submit" value="Submit"/> <input type="button" value="Cancel" onclick="window.location='<?php echo REQUEST_SCRIPT; ?> '"/> </p> </form> <?php return true; }