CMS  Version 3.9
document_search.inc
Go to the documentation of this file.
1 <?php
2 /**************************************************************
3 
4  Copyright (c) 2010 Sonjara, Inc
5 
6  Permission is hereby granted, free of charge, to any person
7  obtaining a copy of this software and associated documentation
8  files (the "Software"), to deal in the Software without
9  restriction, including without limitation the rights to use,
10  copy, modify, merge, publish, distribute, sublicense, and/or sell
11  copies of the Software, and to permit persons to whom the
12  Software is furnished to do so, subject to the following
13  conditions:
14 
15  The above copyright notice and this permission notice shall be
16  included in all copies or substantial portions of the Software.
17 
18  Except as contained in this notice, the name(s) of the above
19  copyright holders shall not be used in advertising or otherwise
20  to promote the sale, use or other dealings in this Software
21  without prior written authorization.
22 
23  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
25  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
27  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
28  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30  OTHER DEALINGS IN THE SOFTWARE.
31 
32 *****************************************************************/
33 
34 require_once "../../include/config.inc";
35 require_once "../datamodel/document.inc";
36 require_once "../../include/permissions.inc";
37 require_once "../datamodel/journal.inc";
38 require_once "../datamodel/region.inc";
39 require_once "../datamodel/topic.inc";
40 require_once "../datamodel/setting.inc";
41 require_once "../datamodel/sample.inc";
42 require_once "../datamodel/grp.inc";
43 require_once "../../framework/tree.inc";
44 
45 $regions = query(Region, "ORDER BY region_id");
46 $topics = query(Topic, "ORDER BY topic");
47 $groups = query(Grp, "ORDER BY title");
48 $grpTopics= groupedQuery(GrpTopicXref, "WHERE 1=1", "grp_id");
49 
50 $gpTree = new TreeControl("grp_id");
51 $gpTree->width = 500;
52 $gpTree->height = 280;
53 $gpTree->selectMode = "single";
54 foreach($groups as $group)
55 {
56  $groupNode = new TreeNode($group->grp_id, $group->title, $group->grp_id, false, 'bare_node_closed', 'bare_node_open', "");
57  $groupNode->leafStyle = "bare_node_leaf";
58  $children = $grpTopics[$group->grp_id];
59 
60  if($children)
61  {
62  foreach($children as $child)
63  {
64 
65  $topicNode = new TreeNode('topic_id', $topics[$child->topic_id]->topic, $child->topic_id, false, "bare_node_closed", "bare_node_open", "");
66  $topicNode->leafStyle = "bare_node_leaf";
67  $groupNode->add($topicNode);
68  }
69  }
70  $gpTree->add($groupNode);
71 
72 }
73 $script = $gpTree->writeScript();
74 $script .= "<link type='text/css' rel='stylesheet' href='/css/tree.css'/>";
75 
76 
77 $settings = query(Setting, "ORDER BY setting_id");
78 $samples = query(Sample, "ORDER BY sample_id");
79 $journals = query(Journal, "ORDER BY title");
80 
81 $menu_item = "Publications";
82 $title = "Search Publications";
83 
84 
85 
86 
87 
88 
89 ?>
90 
91 <p>Select as many categories as needed to narrow your search of the Publications database.</p>
92 <form method="GET" action="results.php">
93 
94 <table width="100%">
95 <tr>
96 <td><label>Regions:</label></td>
97 <td>
98 <select name='region_id'>
99 <option value="">Select region</option><?
100 foreach($regions as $region)
101 {
102 ?>
103  <option value="<?echo $region->region_id ?>"><?echo $region->region ?></option>
104 
105 <?
106 }
107 
108 ?>
109 </select>
110 </td>
111 </tr>
112 <?php
113 /*$children = $eventSubSteps[$eventStep->event_step_key];
114  if($children){
115  foreach($children as $child)
116  {
117  $childNode = new TreeNode("event_sub_step_{$child->event_sub_step_key}", $child->name, null, false, "tree_node_closed", "tree_node_open", "event_sub_step_form.php?event_sub_step_key={$child->event_sub_step_key}&initiative_key={$initiative_key}");
118  $eventStepNode->add($childNode);
119  }
120  }
121  $eventStepTree->add($eventStepNode); */
122  ?>
123 <tr><td><label>Groups/Topics:</label></td>
124 <td>
125 <?
126 $gpTree->writeHTML();
127 ?>
128 </td>
129 </tr>
130 
131 <tr><td><label>Study Settings:</label></td>
132 <td>
133 
134 <select name='setting_id'>
135 <option value="">Select study setting type</option>
136 <?
137 foreach($settings as $setting)
138 {
139 ?>
140  <option value="<?echo $setting->setting_id ?>"><?echo $setting->setting ?></option>
141 
142 <?
143 }
144 
145 ?>
146 </select>
147 
148 </td>
149 </tr>
150 
151 <tr><td><label>Study Samples:</label></td>
152 <td>
153 
154 <select name='sample_id'>
155 <option value="">Select study sample type</option>
156 <?
157 foreach($samples as $sample)
158 {
159 ?>
160  <option value="<?echo $sample->sample_id ?>"><?echo $sample->sample ?></option>
161 
162 <?
163 }
164 ?>
165 </select>
166 
167 </td>
168 </tr>
169 
170 
171 <tr><td><label>Publication Year:</label></td>
172 <td>
173 
174 <input type='text' name='publication_year' size='4' maxlength='4' onkeydown='return maskInput(event);'/>
175 
176 </td>
177 </tr>
178 
179 <tr><td><label>Journal:</label></td>
180 <td>
181 <select name='journal_id'>
182 <option value="">Select journal</option>
183 <? foreach($journals as $journal)
184 {
185 ?>
186  <option value="<?echo $journal->journal_id ?>"><?echo ellipsis($journal->title, 80, true) ?></option>
187 
188 <?
189 }
190 ?>
191 </select>
192 
193 </td>
194 </tr>
195 
196 <tr><td><label>Text Search: </label></td>
197 <td>
198 <input type='text' name='searchText' size='60'/>
199 </td>
200 </tr>
201 <tr>
202  <td><label>Author:</label></td>
203  <td><input type="text" name="author" size="40"/></td>
204 </tr>
205 <tr><td colspan=2 align="right">
206 
207 <input type="submit" class="button" value="Search"> <input class="button" type="reset" value="Clear"></td>
208 
209 </tr>
210 
211 </table>
212 </form>
213 
214 <br/>
215 <br/>
216 <a href="publication_form.php" class="button"> Add a New Publication </a>
217 
218 
219 <br/>
220 <?
221 
222 ?>
$imageUpload size
Definition: image_form.inc:68
$form action
Definition: edit.inc:67
The Settings class provides components with a common API for specifying application settings and conf...
Definition: settings.inc:49
This class maps the topic table.
Definition: topic.inc:38
$grpTopics
$regions
$gpTree width
$samples
$journals
$menu_item
$settings
foreach($groups as $group) $script
$forumRequest to
$topicList colspan
Definition: group_form.inc:54
$group
Definition: group_form.inc:43
text align
Definition: redirects.inc:13
$setting