commit | author | age
|
25ece9
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
436ed8
|
4 |
Copyright (c) 2007, Till Brehm, projektfarm Gmbh |
25ece9
|
5 |
All rights reserved. |
T |
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
|
31 |
class searchform_tpl_generator { |
b1a6a5
|
32 |
|
MC |
33 |
function buildHTML($listDef, $module = '') { |
|
34 |
|
25ece9
|
35 |
global $app; |
b1a6a5
|
36 |
|
25ece9
|
37 |
$lang = array(); |
T |
38 |
$html = '<form name="myform" action="'.$listDef["file"].'" method="POST"> |
|
39 |
<div class="frmTextHead"><tmpl_var name="list_head_txt"></div><br /> |
|
40 |
<tmpl_if name="searchform_visible"> |
|
41 |
<table border="0" cellspacing="0" cellpadding="4">'; |
|
42 |
|
|
43 |
$lang["list_head_txt"] = $listDef["name"]; |
|
44 |
foreach($listDef["item"] as $field) { |
|
45 |
$key = $field["field"]; |
b1a6a5
|
46 |
|
25ece9
|
47 |
if($field["formtype"] == 'SELECT') { |
T |
48 |
$html .= " |
|
49 |
<tr> |
|
50 |
<td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td> |
|
51 |
<td><select name=\"".$listDef["search_prefix"].$key."\">{tmpl_var name='".$listDef["search_prefix"].$key."'}</select></td> |
|
52 |
</tr>"; |
b1a6a5
|
53 |
} else { |
25ece9
|
54 |
$html .= " |
T |
55 |
<tr> |
|
56 |
<td class=\"frmText11\"><tmpl_var name=\"".$key."_txt\">:</td> |
|
57 |
<td><input type=\"text\" name=\"".$listDef["search_prefix"].$key."\" value=\"{tmpl_var name='".$listDef["search_prefix"].$key."'}\" class=\"text\" /></td> |
|
58 |
</tr>"; |
b1a6a5
|
59 |
} |
25ece9
|
60 |
} |
T |
61 |
|
b1a6a5
|
62 |
$html .= ' |
25ece9
|
63 |
<tr> |
T |
64 |
<td colspan="2" align="center"><input name="Filter" type="image" id="Filter" src="../themes/iprg/images/btn_filter.png"></td> |
|
65 |
</tr> |
|
66 |
</table> |
|
67 |
</tmpl_if> |
|
68 |
<tmpl_if name="searchresult_visible"> |
|
69 |
<p> |
b1a6a5
|
70 |
[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=yes">Neue Suche</a>] |
a9d0b2
|
71 |
[<a class="frmText11" href="domain_search.php?searchform_visible=yes&searchresult_visible=no&empty_searchfields=no">Suchkriterien ändern</a>] |
b1a6a5
|
72 |
Suche speichern unter: <input type="text" name="search_save_as" /> <input type="submit" name="btn_submit_search_save" value="Speichern" /> |
25ece9
|
73 |
</p> |
T |
74 |
<table width="100%" border="0" cellspacing="0" cellpadding="4"> |
|
75 |
<tr> |
|
76 |
'; |
b1a6a5
|
77 |
|
25ece9
|
78 |
$lang["list_head_txt"] = $listDef["name"]; |
T |
79 |
foreach($listDef["item"] as $field) { |
|
80 |
$key = $field["field"]; |
|
81 |
$html .= "<tmpl_if name='".$key."_visible'>"; |
|
82 |
$html .= " <td class=\"tblHead\"><tmpl_var name=\"".$key."_txt\"></td>\r\n"; |
|
83 |
$html .= "</tmpl_if>"; |
|
84 |
$lang[$key."_txt"] = $key; |
|
85 |
} |
b1a6a5
|
86 |
|
25ece9
|
87 |
$html .= ' <td class="tblHead"> </td> |
T |
88 |
</tr> |
|
89 |
<tmpl_loop name="records"> |
|
90 |
<tr bgcolor="{tmpl_var name="bgcolor"}"> |
|
91 |
'; |
b1a6a5
|
92 |
|
25ece9
|
93 |
foreach($listDef["item"] as $field) { |
T |
94 |
$key = $field["field"]; |
|
95 |
$html .= "<tmpl_if name='".$key."_visible'>"; |
|
96 |
$html .= " <td class=\"frmText11\"><a href=\"".$listDef["edit_file"]."?id={tmpl_var name='id'}\" class=\"frmText11\">{tmpl_var name=\"".$key."\"}</a></td>\r\n"; |
|
97 |
$html .= "</tmpl_if>"; |
|
98 |
} |
b1a6a5
|
99 |
|
25ece9
|
100 |
$html .= " <td class=\"frmText11\" align=\"right\">[<a href=\"javascript: del_record('".$listDef["delete_file"]."?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}');\" class=\"frmText11\">{tmpl_var name='delete_txt'}</a>]</td> |
T |
101 |
</tr> |
|
102 |
</tmpl_loop> |
|
103 |
"; |
b1a6a5
|
104 |
$html .= ' |
25ece9
|
105 |
</table><table width="100%" border="0" cellspacing="0" cellpadding="4"> |
T |
106 |
<tr> |
|
107 |
<td height="40" align="center" class="tblFooter"><tmpl_var name="paging"></td> |
|
108 |
</tr> |
|
109 |
</table> |
|
110 |
</tmpl_if> |
|
111 |
</form>'; |
b1a6a5
|
112 |
|
25ece9
|
113 |
if($module == '') { |
T |
114 |
$filename = 'templates/'.$listDef["name"].'_search.htm'; |
|
115 |
} else { |
|
116 |
$filename = '../'.$module.'/templates/'.$listDef["name"].'_search.htm'; |
|
117 |
} |
b1a6a5
|
118 |
|
MC |
119 |
|
25ece9
|
120 |
// speichere Template |
b1a6a5
|
121 |
if (!$handle = fopen($filename, 'w')) { |
MC |
122 |
print "Cannot open file ($filename)"; |
|
123 |
exit; |
|
124 |
} |
|
125 |
|
|
126 |
if (!fwrite($handle, $html)) { |
|
127 |
print "Cannot write to file ($filename)"; |
|
128 |
exit; |
25ece9
|
129 |
} |
T |
130 |
fclose($handle); |
b1a6a5
|
131 |
|
MC |
132 |
} |
|
133 |
|
25ece9
|
134 |
} |
T |
135 |
|
b1a6a5
|
136 |
?> |