function makeList($uid, $selfurl, $offset = 0, $numShow = 75) { $db = DB_DataObject::factory('playsms_tblUserInbox'); if (!$offset) { $offset = 0; } $db->limit($offset, $numShow); $db->orderBy("in_id DESC"); $pagetitle = "Inbox"; if (isadmin() && !$uid) { $pagetitle .= " (All)"; } else { $db->in_uid = $uid; } $db->in_hidden = '0'; if ($offset) { $newOffset = $offset - $numShow; $prevUrl = "{$selfurl}&offset={$newOffset}"; } else { $prevUrl = "#"; } $note = "<p>Note: This inbox shows messages not processed by any of the features (e.g., AutoReply, Poll, etc)</p>"; $newOffset = $offset + $numShow; $nextUrl = "{$selfurl}&offset={$newOffset}"; $exportUrl = "{$selfurl}&op=export"; $linksPrevNext = "<a href='{$prevUrl}'>[ Prev] </a>\n \t\t \t\t <a href='{$nextUrl}'>[ Next ]</a>\n <a href='{$exportUrl}'>[ Export ]</a>"; // create hidden form with the // id to delete, this way it will // get POSTed // $delForm = generateActionSubmitter("del", "{$selfurl}&op=del", "id"); $content = "{$delForm}\n\t\t <h2>{$pagetitle}</h2>\n\t\t <p/>\n\t\t\t{$linksPrevNext}\n\t\t <p/>{$note}\n\t\t <table width=100% cellpadding=1 cellspacing=1 border=1>\n\t\t <tr>\n\t\t <td align=center class=box_title width=4>*</td>\n\t\t <td align=center class=box_title width=20%>Time</td>\n\t\t <td align=center class=box_title width=20%>Sender</td>\n\t\t <td align=center class=box_title width=60%>Message</td>\n\t\t <td align=center class=box_title>Action</td>\n\t\t </tr>\n\t\t"; $db->find(); while ($db->fetch()) { $in_id = $db->in_id; $in_sender = $db->in_sender; $p_desc = pnum2pdesc($in_sender); $current_sender = $in_sender; if ($p_desc) { $current_sender = "{$in_sender}<br>({$p_desc})"; } $in_msg = nl2br($db->in_msg); $in_datetime = $db->in_datetime; $deleteCode = "javascript: del({$db->in_id}, " . "'Are you sure you want to delete this SMS ?');"; $actionCode = "<a href=\"{$deleteCode}\">[Delete]</a>"; $content .= "\n\t\t\t<tr>\n\t\t\t\t<td valign=top class=box_text align=left width=4>{$db->in_id}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$in_datetime}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$current_sender}</td>\n\t\t\t\t<td valign=top class=box_text align=left width=60%>{$in_msg}</td>\n\t\t\t\t<td valign=top class=box_text align=left nowrap>{$actionCode}</td>\n\t\t\t</tr>\n\t\t "; } $content .= "</table>"; return $content; }
function makeList($uid, $selfurl, $offset = 0, $numShow = 75) { $db = DB_DataObject::factory('playsms_tblSMSOutgoing'); if (!$offset) { $offset = 0; } $db->limit($offset, $numShow); $db->orderBy("smslog_id DESC"); $pagetitle = "Delivery report"; if (isadmin() && !$uid) { $pagetitle .= " (All)"; } else { $db->uid = $uid; } $db->flag_deleted = '0'; if ($offset) { $newOffset = $offset - $numShow; $prevUrl = "{$selfurl}&offset={$newOffset}"; } else { $prevUrl = "#"; } $newOffset = $offset + $numShow; $nextUrl = "{$selfurl}&offset={$newOffset}"; $exportUrl = "{$selfurl}&op=export"; $linksPrevNext = "<a href='{$prevUrl}'>[ Prev] </a>\n \t\t \t\t <a href='{$nextUrl}'>[ Next ]</a>\n <a href='{$exportUrl}'>[ Export ]</a>"; // create hidden form with the // id to delete, this way it will // get POSTed // $delForm = generateActionSubmitter("del", "{$selfurl}&op=del", "smslog_id"); $resendForm = generateActionSubmitter("resend", "{$selfurl}&op=resend", "smslog_id"); $content = "{$delForm} \n {$resendForm}\n \t\t <h2>{$pagetitle}</h2>\n \t\t <p/>\n\t\t\t\t{$linksPrevNext}\n \t\t <p/>\n \t\t <table width=100% cellpadding=1 cellspacing=1 border=1>\n \t\t <tr>\n \t\t <td align=center class=box_title width=2%>id</td>\n \t\t <td align=center class=box_title width=12%>Time</td>\n \t\t <td align=center class=box_title width=12%>Receiver</td>\n \t\t <td align=center class=box_title width=50%>Message</td>\n \t\t <td align=center class=box_title width=8%>Status</td>\n \t\t <td align=center class=box_title width=8%>Group</td>\n \t\t <td align=center class=box_title width=8%>Action</td>\n \t\t </tr>\n \t\t"; $db->find(); while ($db->fetch()) { $p_desc = pnum2pdesc($db->p_dst); $current_p_dst = $db->p_dst; if ($p_desc) { $current_p_dst = "{$db->p_dst}<br/>({$p_desc})"; } $hide_p_dst = $db->p_dst; if ($p_desc) { $hide_p_dst = "{$p_dst} ({$p_desc})"; } $p_sms_type = $db->p_sms_type; $hide_p_dst = str_replace("\\'", "", $hide_p_dst); $hide_p_dst = str_replace("\"", "", $hide_p_dst); $p_msg = nl2br($db->p_msg); if (($p_footer = $db->p_footer) && ($p_sms_type == "text" || $p_sms_type == "flash")) { $p_msg = $p_msg . " {$p_footer}"; } $p_datetime = $db->p_datetime; $p_update = $db->p_update; $p_status = $db->p_status; $p_gpid = $db->p_gpid; $status_color = getStatusColor($p_status); $status_name = getStatusName($p_status); $p_status = "<font color={$status_color}>{$status_name}</font> <br/>({$db->send_tries} tries)"; $p_status .= " {$db_row['p_status']}"; if ($p_gpid) { $db_query1 = "SELECT gp_code FROM playsms_tblUserGroupPhonebook WHERE gpid='{$p_gpid}'"; $db_result1 = dba_query($db_query1); $db_row1 = dba_fetch_array($db_result1); $p_gpcode = strtoupper($db_row1[gp_code]); } else { $p_gpcode = " "; } $deleteCode = "javascript: del({$db->smslog_id}, " . "'Are you sure you want to delete outgoing SMS to `{$hide_p_dst}`, number {$db->smslog_id} ?');"; $resendCode = "javascript: resend({$db->smslog_id});"; $actionCode = "<a href=\"{$deleteCode}\">[Delete]</a> <br/>\n\t\t <a href=\"{$resendCode}\">[Resend]</a>"; $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=top class=box_text align=left width=2%>{$db->smslog_id}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=12%>{$db->p_datetime}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=12%>{$current_p_dst}</td>\n\t\t\t\t\t<td valign=top class=box_text align=left width=50%>{$p_msg}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>{$p_status}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>{$p_gpcode}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>\n\t\t\t\t\t\t{$actionCode}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t "; } $content .= "</form></table>\n \t\t\t<p/>\n \t\t {$linksPrevNext}"; return $content; }