-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetAllResultsBy.php
More file actions
109 lines (84 loc) · 3.19 KB
/
Copy pathgetAllResultsBy.php
File metadata and controls
109 lines (84 loc) · 3.19 KB
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
106
107
108
109
<?php
include("utilities.php");
$result = $_GET["result"];
$xml=getXML("note.xml");
// get document element
$root = $xml->documentElement;
$notes = $root->childNodes->item(3);
$notesFound = 0;
if($result=="id")
{
echo ("<select id='searchOptions' onchange='showSearchResults(this.value)'> ");
echo ("<option value=''>Choose an ID</option>");
foreach($notes->childNodes as $note)
{
$notesFound++;
$noteID = $note->getAttribute('id');
echo ("<option value='$noteID'>Note ID: $noteID</option>");
}
echo ("</select>");
if($notesFound==0) echo("</br> No notes found");
}
else if($result=="sender")
{
echo ("<select id='searchOptions' onchange='showSearchResults(this.value)'> ");
echo ("<option value=''>Choose a Sender</option>");
$senderList = array();
foreach($notes->childNodes as $note)
{
$notesFound++;
$noteSenderNode = $note->childNodes->item(1);
$senderID = $noteSenderNode->getAttribute('id');
$senderTitleNode = $noteSenderNode->childNodes->item(0);
$senderForenameNode = $noteSenderNode->childNodes->item(1);
$senderSurnameNode = $noteSenderNode->childNodes->item(2);
if(!array_key_exists($senderID, $senderList))
{
$senderList [$senderID] = $senderTitleNode->nodeValue." ".$senderForenameNode->nodeValue." ".$senderSurnameNode->nodeValue;
}
}
foreach($senderList as $key=>$value)
{
echo ("<option value='$key'>Sender: $value</option>");
}
echo ("</select>");
if($notesFound==0) echo("</br> No notes found");
}
else if($result=="recipient")
{
echo ("<select id='searchOptions' onchange='showSearchResults(this.value)'> ");
echo ("<option value=''>Choose a Recipient</option>");
$recipientList=array();
foreach($notes->childNodes as $note)
{
$notesFound++;
$noteRecipientsNode = $note->childNodes->item(2);
foreach($noteRecipientsNode->childNodes as $recipients)
{
$recipientID = $recipients->getAttribute('id');
$recipientsTitleNode = $recipients->childNodes->item(0);
$recipientsForenameNode = $recipients->childNodes->item(1);
$recipientsSurnameNode = $recipients->childNodes->item(2);
if(!array_key_exists($recipientID, $recipientList))
{
$recipientList [$recipientID] = $recipientsTitleNode->nodeValue." ".$recipientsForenameNode->nodeValue." ".$recipientsSurnameNode->nodeValue;
}
}
}
foreach($recipientList as $key=>$value)
{
echo ("<option value='$key'>Recipients: $value</option>");
}
echo ("</select>");
if($notesFound==0) echo("</br> No notes found");
}
else if($result=="status")
{
echo ("<select id='searchOptions' onchange='showSearchResults(this.value)'> ");
echo ("<option value=''>Choose a Status</option>");
echo ("<option value='new'>Status: New </option>");
echo ("<option value='current'>Status: Current </option>");
echo ("<option value='historic'>Status: Historic </option>");
echo ("</select>");
}
?>