2012-06-04 16:58:40 +02:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
FusionPBX
|
|
|
|
|
Version: MPL 1.1
|
|
|
|
|
|
|
|
|
|
The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
http://www.mozilla.org/MPL/
|
|
|
|
|
|
|
|
|
|
Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
for the specific language governing rights and limitations under the
|
|
|
|
|
License.
|
|
|
|
|
|
|
|
|
|
The Original Code is FusionPBX
|
|
|
|
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
Portions created by the Initial Developer are Copyright (C) 2008-2012
|
|
|
|
|
the Initial Developer. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
Contributor(s):
|
|
|
|
|
Mark J Crane <markjcrane@fusionpbx.com>
|
|
|
|
|
*/
|
|
|
|
|
require_once "root.php";
|
2013-07-06 08:03:27 +02:00
|
|
|
require_once "resources/require.php";
|
2013-07-06 07:50:55 +02:00
|
|
|
require_once "resources/check_auth.php";
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_view')) {
|
2012-06-04 16:58:40 +02:00
|
|
|
//access granted
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo "access denied";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
2013-06-21 18:02:05 +02:00
|
|
|
|
2014-07-30 01:42:34 +02:00
|
|
|
//require_once "resources/header.php";
|
2013-07-06 08:29:50 +02:00
|
|
|
require_once "resources/paging.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
|
|
|
|
$order_by = $_GET["order_by"];
|
|
|
|
|
$order = $_GET["order"];
|
|
|
|
|
|
|
|
|
|
//show the content
|
|
|
|
|
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
|
|
|
|
echo "<tr class='border'>\n";
|
|
|
|
|
echo " <td align=\"center\">\n";
|
|
|
|
|
echo " <br>";
|
|
|
|
|
|
|
|
|
|
echo "<table width='100%' border='0'>\n";
|
|
|
|
|
echo "<tr>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo "<td width='50%' align=\"left\" nowrap=\"nowrap\"><b>".$text['header-fields']."</b></td>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<td width='50%' align=\"right\"> </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "<tr>\n";
|
|
|
|
|
echo "<td align=\"left\" colspan=\"2\">\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo $text['description-fields']."<br /><br />\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
2014-07-30 01:42:34 +02:00
|
|
|
echo "</table>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2012-08-31 05:11:15 +02:00
|
|
|
if (strlen($order_by) == 0) {
|
2013-03-25 20:15:27 +01:00
|
|
|
$order_by = 'field_order';
|
2012-06-04 16:58:40 +02:00
|
|
|
$order = 'asc';
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql = "select * from v_schema_fields ";
|
2012-08-31 05:11:15 +02:00
|
|
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
2013-04-11 18:56:30 +02:00
|
|
|
$sql .= "and schema_uuid = '$schema_uuid' ";
|
2012-06-04 16:58:40 +02:00
|
|
|
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
|
|
|
|
|
$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";
|
|
|
|
|
|
2014-06-22 06:34:19 +02:00
|
|
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
echo "<tr>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo th_order_by('field_label', $text['label-field_label'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_name', $text['label-field_name'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_type', $text['label-field_type'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_column', $text['label-field_column'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_required', $text['label-field_required'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_list_hidden', $text['label-field_visibility'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_search_by', $text['label-field_search_by'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_order', $text['label-field_order'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_order_tab', $text['label-field_tab_order'], $order_by, $order);
|
|
|
|
|
echo th_order_by('field_description', $text['label-field_description'], $order_by, $order);
|
2014-02-26 06:49:39 +01:00
|
|
|
echo "<td class='list_control_icons'>";
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_view')) {
|
2014-02-26 06:49:39 +01:00
|
|
|
echo "<a href='schema_field_edit.php?schema_uuid=".$schema_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo "</td>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo "</tr>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2012-08-31 05:11:15 +02:00
|
|
|
if ($result_count > 0) {
|
2012-06-04 16:58:40 +02:00
|
|
|
foreach($result as $row) {
|
2014-06-22 06:34:19 +02:00
|
|
|
$tr_link = (permission_exists('schema_edit')) ? "href='schema_field_edit.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."'" : null;
|
|
|
|
|
echo "<tr ".$tr_link.">\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_label']." </td>\n";
|
2014-06-21 05:42:09 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if (permission_exists('schema_edit')) {
|
|
|
|
|
echo "<a href='schema_field_edit.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."'>".$row['field_name']."</a>";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
echo $row['field_name'];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
switch ($row['field_type']) {
|
|
|
|
|
case "text" : echo $text['option-text']; break;
|
|
|
|
|
case "numeric" : echo $text['option-number']; break;
|
|
|
|
|
case "date" : echo $text['option-date']; break;
|
|
|
|
|
case "email" : echo $text['option-email']; break;
|
|
|
|
|
case "label" : echo $text['option-label']; break;
|
|
|
|
|
case "phone" : echo $text['option-phone']; break;
|
|
|
|
|
case "checkbox" : echo $text['option-check_box']; break;
|
|
|
|
|
case "textarea" : echo $text['option-text_area']; break;
|
|
|
|
|
case "select" : echo $text['option-select']; break;
|
|
|
|
|
case "hidden" : echo $text['option-hidden']; break;
|
|
|
|
|
case "uuid" : echo $text['option-uuid']; break;
|
|
|
|
|
case "password" : echo $text['option-password']; break;
|
|
|
|
|
case "pin_number" : echo $text['option-pin_number']; break;
|
|
|
|
|
case "image" : echo $text['option-image_upload']; break;
|
|
|
|
|
case "upload_file" : echo $text['option-file_upload']; break;
|
|
|
|
|
case "url" : echo $text['option-url']; break;
|
|
|
|
|
case "mod_date" : echo $text['option-modified_date']; break;
|
|
|
|
|
case "mod_user" : echo $text['option-modified_user']; break;
|
|
|
|
|
default : echo $row['field_type'];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_column']."</td>\n";
|
2013-06-21 18:02:05 +02:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if ($row['field_required'] == 'yes') {
|
|
|
|
|
echo $text['option-true'];
|
|
|
|
|
}
|
|
|
|
|
else if ($row['field_required'] == 'no') {
|
|
|
|
|
echo $text['option-false'];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if ($row['field_list_hidden'] == 'show') {
|
|
|
|
|
echo $text['option-visible'];
|
|
|
|
|
}
|
|
|
|
|
else if ($row['field_list_hidden'] == 'hide') {
|
|
|
|
|
echo $text['option-hidden'];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
|
|
|
|
if ($row['field_search_by'] == 'yes') {
|
|
|
|
|
echo $text['option-true'];
|
|
|
|
|
}
|
|
|
|
|
else if ($row['field_search_by'] == 'no') {
|
|
|
|
|
echo $text['option-false'];
|
|
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
2013-03-25 20:15:27 +01:00
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_order']."</td>\n";
|
|
|
|
|
echo " <td valign='top' class='".$row_style[$c]."'>".$row['field_order_tab']."</td>\n";
|
2014-06-22 06:34:19 +02:00
|
|
|
echo " <td valign='top' class='row_stylebg'>".$row['field_description']." </td>\n";
|
2014-02-26 06:49:39 +01:00
|
|
|
echo " <td class='list_control_icons'>";
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_edit')) {
|
2014-02-26 06:49:39 +01:00
|
|
|
echo "<a href='schema_field_edit.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_delete')) {
|
2014-02-26 06:49:39 +01:00
|
|
|
echo "<a href='schema_field_delete.php?schema_uuid=".$row['schema_uuid']."&id=".$row['schema_field_uuid']."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
if ($c==0) { $c=1; } else { $c=0; }
|
|
|
|
|
} //end foreach
|
|
|
|
|
unset($sql, $result, $row_count);
|
|
|
|
|
} //end if results
|
|
|
|
|
|
|
|
|
|
echo "<tr>\n";
|
2012-11-12 20:13:54 +01:00
|
|
|
echo "<td colspan='11' align='left'>\n";
|
2012-06-04 16:58:40 +02:00
|
|
|
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> </td>\n";
|
2014-02-26 06:49:39 +01:00
|
|
|
echo " <td class='list_control_icons'>";
|
2013-04-11 18:56:30 +02:00
|
|
|
if (permission_exists('schema_add')) {
|
2014-02-26 06:49:39 +01:00
|
|
|
echo "<a href='schema_field_edit.php?schema_uuid=".$schema_uuid."' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
2012-06-04 16:58:40 +02:00
|
|
|
}
|
|
|
|
|
echo " </td>\n";
|
|
|
|
|
echo " </tr>\n";
|
|
|
|
|
echo " </table>\n";
|
|
|
|
|
echo "</td>\n";
|
|
|
|
|
echo "</tr>\n";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
|
|
|
|
|
echo "</td>";
|
|
|
|
|
echo "</tr>";
|
|
|
|
|
echo "</table>";
|
|
|
|
|
echo "<br><br>";
|
|
|
|
|
|
|
|
|
|
//include the footer
|
2014-07-30 01:42:34 +02:00
|
|
|
// require_once "resources/footer.php";
|
2012-06-04 16:58:40 +02:00
|
|
|
|
2013-04-11 18:56:30 +02:00
|
|
|
?>
|