get(); //get variables used to control the order $order_by = ($_GET["order_by"] != '') ? $_GET["order_by"] : 'sent_date'; $order = ($_GET["order"] != '') ? $_GET["order"] : 'desc'; //get the fax_uuid if (count($_GET) > 0) { $email_uuid = check_str($_GET["id"]); } //additional includes $document['title'] = $text['title-emails']; require_once "resources/header.php"; require_once "resources/paging.php"; //show the content echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
"; echo " ".$text['header-emails'].""; echo "

"; echo " ".$text['description-emails']; echo "
\n"; echo " \n"; echo "
\n"; echo "
\n"; //prepare to page the results $sql = "select count(*) as num_rows from v_emails "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $prep_statement = $db->prepare($sql); if ($prep_statement) { $prep_statement->execute(); $row = $prep_statement->fetch(PDO::FETCH_ASSOC); $num_rows = ($row['num_rows'] > 0) ? $row['num_rows'] : 0; } //prepare to page the results $rows_per_page = 50; $param = ""; $page = $_GET['page']; if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page); $offset = $rows_per_page * $page; //get the list $sql = "select * from v_emails "; $sql .= "where domain_uuid = '".$domain_uuid."' "; if (strlen($order_by)> 0) { $sql .= "order by ".$order_by." ".$order." "; } $sql .= "limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result_count = count($result); unset ($prep_statement, $sql); $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; echo "\n"; echo "\n"; echo th_order_by('sent_date', $text['label-sent'], $order_by, $order); echo th_order_by('type', $text['label-type'], $order_by, $order); echo th_order_by('status', $text['label-status'], $order_by, $order); echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if ($result_count > 0) { foreach($result as $row) { //get call details $sql = "select caller_id_name, caller_id_number, destination_number from v_xml_cdr "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and uuid = '".$row['call_uuid']."' "; //echo ""; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result2 = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach($result2 as $row2) { $caller_id_name = ($row2['caller_id_name'] != '') ? $row2['caller_id_name'] : null; $caller_id_number = ($row2['caller_id_number'] != '') ? $row2['caller_id_number'] : null; $destination_number = ($row2['destination_number'] != '') ? $row2['destination_number'] : null; } unset($prep_statement, $sql); $tr_link = "href='email_view.php?id=".$row['email_uuid']."'"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; if ($c==0) { $c=1; } else { $c=0; } } //end foreach unset($sql, $result, $row_count); } //end if results echo "\n"; echo "\n"; echo "\n"; echo "
".$text['label-message']."".$text['label-attachment']."".$text['label-reference']." 
".$sql."
"; $sent_date = explode('.', $row['sent_date']); echo $sent_date[0]; echo " ".$text['label-type_'.$row['type']]."".$text['label-status_'.$row['status']]."".$text['label-message_view'].""; echo "$v_link_label_view"; if (permission_exists('email_delete')) { echo "$v_link_label_delete"; } echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
 $paging_controls 
\n"; echo "
"; echo "

"; //include the footer require_once "resources/footer.php"; ?>