Contacts: Ability to add unlimited Emails and URLs. Ability to specify a primary Email, Address, URL, and Number. Ability to select or define a custom label for Emails, Addresses, URLs, and Numbers (similar to Google Contacts).
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
require_once "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
//require_once "resources/header.php";
|
||||
require_once "resources/paging.php";
|
||||
|
||||
//get variables used to control the order
|
||||
@@ -35,40 +34,43 @@ require_once "resources/paging.php";
|
||||
$order = check_str($_GET["order"]);
|
||||
|
||||
//prepare to page the results
|
||||
$sql = "select count(*) as num_rows from v_contact_settings ";
|
||||
$sql .= "where contact_uuid = '$contact_uuid' ";
|
||||
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
$prep_statement = $db->prepare($sql);
|
||||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row['num_rows'] > 0) {
|
||||
$num_rows = $row['num_rows'];
|
||||
}
|
||||
else {
|
||||
$num_rows = '0';
|
||||
}
|
||||
}
|
||||
// $sql = "select count(*) as num_rows from v_contact_settings ";
|
||||
// $sql .= "where contact_uuid = '$contact_uuid' ";
|
||||
// if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
||||
// $prep_statement = $db->prepare($sql);
|
||||
// if ($prep_statement) {
|
||||
// $prep_statement->execute();
|
||||
// $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
// if ($row['num_rows'] > 0) {
|
||||
// $num_rows = $row['num_rows'];
|
||||
// }
|
||||
// else {
|
||||
// $num_rows = '0';
|
||||
// }
|
||||
// }
|
||||
|
||||
//prepare to page the results
|
||||
$rows_per_page = 100;
|
||||
$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;
|
||||
// $rows_per_page = 2;
|
||||
// $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_contact_settings ";
|
||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||
$sql .= "and contact_uuid = '$contact_uuid' ";
|
||||
if (strlen($order_by) == 0) {
|
||||
$sql .= "order by contact_setting_category, contact_setting_subcategory, contact_setting_order asc ";
|
||||
$sql .= "order by ";
|
||||
$sql .= "contact_setting_category asc ";
|
||||
$sql .= ", contact_setting_subcategory asc ";
|
||||
$sql .= ", contact_setting_order asc ";
|
||||
}
|
||||
else {
|
||||
$sql .= "order by $order_by $order ";
|
||||
$sql .= "order by ".$order_by." ".$order." ";
|
||||
}
|
||||
$sql .= "limit $rows_per_page offset $offset ";
|
||||
// $sql .= "limit ".$rows_per_page." offset ".$offset." ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
$prep_statement->execute();
|
||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||
@@ -80,45 +82,37 @@ require_once "resources/paging.php";
|
||||
$row_style["1"] = "row_style1";
|
||||
|
||||
//show the content
|
||||
if ($num_rows == 0) {
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_settings']."</b></td>\n";
|
||||
echo "<td width='50%' align='right'> </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
}
|
||||
echo "<table width='100%' border='0'>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<td width='50%' align='left' nowrap='nowrap'><b>".$text['label-contact_settings']."</b></td>\n";
|
||||
echo "<td width='50%' align='right'> </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo "<tr>";
|
||||
echo " <td colspan='6' align='left'>\n";
|
||||
echo " <b>".ucfirst($row['contact_setting_category'])."</b>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th>".$text['label-contact_category']."</th>";
|
||||
echo "<th>".$text['label-contact_subcategory']."</th>";
|
||||
echo "<th>".$text['label-contact_type']."</th>";
|
||||
echo "<th>".$text['label-contact_value']."</th>";
|
||||
echo "<th style='text-align: center;'>".$text['label-enabled']."</th>";
|
||||
echo "<th>".$text['label-description']."</th>";
|
||||
echo "<td class='list_control_icons'>";
|
||||
echo "<a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
if ($result_count > 0) {
|
||||
$previous_category = '';
|
||||
foreach($result as $row) {
|
||||
if ($previous_category != $row['contact_setting_category']) {
|
||||
echo "<tr>";
|
||||
echo " <td colspan='6' align='left'>\n";
|
||||
echo " <br />\n";
|
||||
echo " <br />\n";
|
||||
echo " <b>";
|
||||
echo " ".ucfirst($row['contact_setting_category']);
|
||||
echo " </b>\n";
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo "<th>".$text['label-contact_subcategory']."</th>";
|
||||
echo "<th>".$text['label-contact_type']."</th>";
|
||||
echo "<th>".$text['label-contact_value']."</th>";
|
||||
echo "<th style='text-align: center;'>".$text['label-enabled']."</th>";
|
||||
echo "<th>".$text['label-description']."</th>";
|
||||
echo "<td class='list_control_icons'>";
|
||||
echo "<a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
$tr_link = " href='contact_setting_edit.php?contact_uuid=".$contact_uuid."&id=".$row['contact_setting_uuid']."'";
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
echo "<a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."&id=".$row['contact_setting_uuid']."'>".$row['contact_setting_subcategory']."</a>";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_setting_category']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'><a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."&id=".$row['contact_setting_uuid']."'>".$row['contact_setting_subcategory']."</a></td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row['contact_setting_name']." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>\n";
|
||||
|
||||
@@ -149,11 +143,11 @@ require_once "resources/paging.php";
|
||||
} //end if results
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td colspan='6' align='left'>\n";
|
||||
echo "<td colspan='7' align='left'>\n";
|
||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td width='33.3%' nowrap> </td>\n";
|
||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
// echo " <td width='33.3%' nowrap> </td>\n";
|
||||
// echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||
echo " <td class='list_control_icons'>";
|
||||
echo "<a href='contact_setting_edit.php?contact_uuid=".$contact_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||
echo " </td>\n";
|
||||
|
||||
Reference in New Issue
Block a user