-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPropertyList.php
105 lines (82 loc) · 3.25 KB
/
PropertyList.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
require_once 'Include/Config.php';
require_once 'Include/Functions.php';
use ChurchCRM\Authentication\AuthenticationManager;
use ChurchCRM\Utils\InputUtils;
use ChurchCRM\Utils\RedirectUtils;
// Get the type to display
$sType = InputUtils::legacyFilterInput($_GET['Type'], 'char', 1);
// Based on the type, set the TypeName
switch ($sType) {
case 'p':
$sTypeName = gettext('Person');
break;
case 'f':
$sTypeName = gettext('Family');
break;
case 'g':
$sTypeName = gettext('Group');
break;
default:
RedirectUtils::redirect('v2/dashboard');
break;
}
$sPageTitle = $sTypeName . ' ' . gettext('Property List');
// Get the properties
$sSQL = "SELECT * FROM property_pro, propertytype_prt WHERE prt_ID = pro_prt_ID AND pro_Class = '" . $sType . "' ORDER BY prt_Name,pro_Name";
$rsProperties = RunQuery($sSQL);
require_once 'Include/Header.php'; ?>
<div class="card card-body">
<?php if (AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
//Display the new property link
echo "<p align=\"center\"><a class='btn btn-primary' href=\"PropertyEditor.php?Type=" . $sType . '">' . gettext('Add a New') . ' ' . $sTypeName . ' ' . gettext('Property') . '</a></p>';
}
// Start the table
echo "<table class='table'>";
echo '<tr>';
echo '<th valign="top">' . gettext('Name') . '</th>';
echo '<th valign="top">' . gettext('A') . ' ' . $sTypeName . ' ' . gettext('with this Property...') . '</b></th>';
echo '<th valign="top">' . gettext('Prompt') . '</th>';
if (AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
echo '<td valign="top"><b>' . gettext('Edit') . '</b></td>';
echo '<td valign="top"><b>' . gettext('Delete') . '</b></td>';
}
echo '</tr>';
echo '<tr><td> </td></tr>';
// Initialize the row shading
$sRowClass = 'RowColorA';
$iPreviousPropertyType = -1;
$sBlankLine = '';
// Loop through the records
while ($aRow = mysqli_fetch_array($rsProperties)) {
$pro_Prompt = '';
$pro_Description = '';
extract($aRow);
// Did the Type change?
if ($iPreviousPropertyType != $prt_ID) {
//Write the header row
echo $sBlankLine;
echo '<tr class="RowColorA"><td colspan="5"><b>' . $prt_Name . '</b></td></tr>';
$sBlankLine = '<tr><td> </td></tr>';
//Reset the row color
$sRowClass = 'RowColorA';
}
$sRowClass = AlternateRowStyle($sRowClass);
echo '<tr class="' . $sRowClass . '">';
echo '<td valign="top">' . $pro_Name . ' </td>';
echo '<td valign="top">';
if (strlen($pro_Description) > 0) {
echo '...' . $pro_Description;
}
echo ' </td>';
echo '<td valign="top">' . $pro_Prompt . ' </td>';
if (AuthenticationManager::getCurrentUser()->isMenuOptionsEnabled()) {
echo "<td valign=\"top\"><a class='btn btn-primary' href=\"PropertyEditor.php?PropertyID=" . $pro_ID . '&Type=' . $sType . '">' . gettext('Edit') . '</a></td>';
echo "<td valign=\"top\"><a class='btn btn-danger' href=\"PropertyDelete.php?PropertyID=" . $pro_ID . '&Type=' . $sType . '">' . gettext('Delete') . '</a></td>';
}
echo '</tr>';
// Store the PropertyType
$iPreviousPropertyType = $prt_ID;
}
echo '</table></div>';
require_once 'Include/Footer.php';