@@ -2,147 +2,147 @@ |
||
2 | 2 | |
3 | 3 | function javascript_include_tag($src) |
4 | 4 | { |
5 | - return "<script type='text/javascript' src='" . PUBLIC_PATH . "js/$src.js'></script>\r\n"; |
|
5 | + return "<script type='text/javascript' src='" . PUBLIC_PATH . "js/$src.js'></script>\r\n"; |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | function stylesheet_link($src = '') |
9 | 9 | { |
10 | - return "<link rel='stylesheet' type='text/css' href='" . PUBLIC_PATH . "css/$src.css'/>\r\n"; |
|
10 | + return "<link rel='stylesheet' type='text/css' href='" . PUBLIC_PATH . "css/$src.css'/>\r\n"; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | function link_to($action, $text, $attributes = '') |
14 | 14 | { |
15 | - return "<a href='" . PUBLIC_PATH . "$action' $attributes>$text</a>"; |
|
15 | + return "<a href='" . PUBLIC_PATH . "$action' $attributes>$text</a>"; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | function img_tag($img, $attributes = '') |
19 | 19 | { |
20 | - return "<img src='" . PUBLIC_PATH . "img/$img' $attributes />\r\n"; |
|
20 | + return "<img src='" . PUBLIC_PATH . "img/$img' $attributes />\r\n"; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | function form_tag($action, $attributes = '') |
24 | 24 | { |
25 | - return "<form action='" . PUBLIC_PATH . "$action' $attributes>\r\n"; |
|
25 | + return "<form action='" . PUBLIC_PATH . "$action' $attributes>\r\n"; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | function end_form_tag() |
29 | 29 | { |
30 | - return "</form>\r\n"; |
|
30 | + return "</form>\r\n"; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | function submit_tag($caption, $attributes = '') |
34 | 34 | { |
35 | - return "<input type='submit' value='$caption' $attributes />\r\n"; |
|
35 | + return "<input type='submit' value='$caption' $attributes />\r\n"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function button_tag($caption, $type = 'button', $attributes = '') |
39 | 39 | { |
40 | - return "<button type='$type' $attributes>$caption</button>\r\n"; |
|
40 | + return "<button type='$type' $attributes>$caption</button>\r\n"; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | function get_field_name_and_id($name) |
44 | 44 | { |
45 | - $id = ""; |
|
46 | - if (strpos($name, ".") !== 0) { |
|
47 | - $items = explode(".", $name); |
|
48 | - $id = " id='{$items[0]}_{$items[1]}' "; |
|
49 | - $name = $items[0] . "[" . $items[1] . "]"; |
|
50 | - } |
|
51 | - return [$id, $name]; |
|
45 | + $id = ""; |
|
46 | + if (strpos($name, ".") !== 0) { |
|
47 | + $items = explode(".", $name); |
|
48 | + $id = " id='{$items[0]}_{$items[1]}' "; |
|
49 | + $name = $items[0] . "[" . $items[1] . "]"; |
|
50 | + } |
|
51 | + return [$id, $name]; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | function text_field_tag($name, $value = '', $attributes = '') |
55 | 55 | { |
56 | - list($id, $name) = get_field_name_and_id($name); |
|
56 | + list($id, $name) = get_field_name_and_id($name); |
|
57 | 57 | |
58 | - return "<input type='text' name='$name' $id value='$value' $attributes />\r\n"; |
|
58 | + return "<input type='text' name='$name' $id value='$value' $attributes />\r\n"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | function password_field_tag($name, $value = '', $attributes = '') |
62 | 62 | { |
63 | - list($id, $name) = get_field_name_and_id($name); |
|
63 | + list($id, $name) = get_field_name_and_id($name); |
|
64 | 64 | |
65 | - return "<input type='password' name='$name' $id value='$value' $attributes />\r\n"; |
|
65 | + return "<input type='password' name='$name' $id value='$value' $attributes />\r\n"; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | function text_area_tag($name, $value = '', $attributes = '') |
69 | 69 | { |
70 | - list($id, $name) = get_field_name_and_id($name); |
|
70 | + list($id, $name) = get_field_name_and_id($name); |
|
71 | 71 | |
72 | - return "<textarea name='$name' $id $attributes>$value</textarea>\r\n"; |
|
72 | + return "<textarea name='$name' $id $attributes>$value</textarea>\r\n"; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | function hidden_field_tag($name, $value = '', $attributes = '') |
76 | 76 | { |
77 | - list($id, $name) = get_field_name_and_id($name); |
|
77 | + list($id, $name) = get_field_name_and_id($name); |
|
78 | 78 | |
79 | - return "<input type='hidden' name='$name' $id value='$value' $attributes />\r\n"; |
|
79 | + return "<input type='hidden' name='$name' $id value='$value' $attributes />\r\n"; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | function check_box_tag($name, $value, $checked = false, $attributes = '') |
83 | 83 | { |
84 | - list($id, $name) = get_field_name_and_id($name); |
|
85 | - $checked = $checked == true ? ' checked ' : ''; |
|
86 | - return "<input type='checkbox' $id name='$name' $checked $attributes value='$value'/>\r\n"; |
|
84 | + list($id, $name) = get_field_name_and_id($name); |
|
85 | + $checked = $checked == true ? ' checked ' : ''; |
|
86 | + return "<input type='checkbox' $id name='$name' $checked $attributes value='$value'/>\r\n"; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | function radio_button_tag($name, $value, $checked = false, $attributes = '') |
90 | 90 | { |
91 | - list($id, $name) = get_field_name_and_id($name); |
|
92 | - $checked = $checked == true ? ' checked ' : ''; |
|
93 | - return "<input type='radio' $id name='$name' $checked $attributes value='$value'/>\r\n"; |
|
91 | + list($id, $name) = get_field_name_and_id($name); |
|
92 | + $checked = $checked == true ? ' checked ' : ''; |
|
93 | + return "<input type='radio' $id name='$name' $checked $attributes value='$value'/>\r\n"; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | function label_tag($field, $caption, $attributes = '') |
97 | 97 | { |
98 | - return "<label for='$field' $attributes>$caption</label>\r\n"; |
|
98 | + return "<label for='$field' $attributes>$caption</label>\r\n"; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | function select_tag($name = '', $options='', $include_blank = false, $attributes = '') |
102 | 102 | { |
103 | - list($id, $name) = get_field_name_and_id($name); |
|
103 | + list($id, $name) = get_field_name_and_id($name); |
|
104 | 104 | |
105 | - $code = ""; |
|
106 | - if ($include_blank != false) { |
|
107 | - $code = "<option value=''>$include_blank</option>\r\n"; |
|
108 | - } |
|
105 | + $code = ""; |
|
106 | + if ($include_blank != false) { |
|
107 | + $code = "<option value=''>$include_blank</option>\r\n"; |
|
108 | + } |
|
109 | 109 | |
110 | - return "<select $id name='$name' $attributes>\r\n$code$options</select>\r\n"; |
|
110 | + return "<select $id name='$name' $attributes>\r\n$code$options</select>\r\n"; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | function options_for_dbselect($data, $show, $value, $selected = '') |
114 | 114 | { |
115 | - $code = ""; |
|
116 | - foreach ($data as $item) { |
|
117 | - $selected_tag = ""; |
|
118 | - if ($selected == $item[$value]) { |
|
119 | - $selected_tag = " selected='selected' "; |
|
120 | - } |
|
121 | - $code .= "<option value='{$item[$value]}' $selected_tag>{$item[$show]}</option>\r\n"; |
|
122 | - } |
|
123 | - return $code; |
|
115 | + $code = ""; |
|
116 | + foreach ($data as $item) { |
|
117 | + $selected_tag = ""; |
|
118 | + if ($selected == $item[$value]) { |
|
119 | + $selected_tag = " selected='selected' "; |
|
120 | + } |
|
121 | + $code .= "<option value='{$item[$value]}' $selected_tag>{$item[$show]}</option>\r\n"; |
|
122 | + } |
|
123 | + return $code; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | function options_for_select($data, $selected = '') |
127 | 127 | { |
128 | - $code = ""; |
|
129 | - foreach ($data as $key => $value) { |
|
130 | - $selected_tag = ""; |
|
131 | - if ($selected == $value) { |
|
132 | - $selected_tag = " selected='selected' "; |
|
133 | - } |
|
134 | - $code .= "<option value='$key' $selected_tag>$value</option>\r\n"; |
|
135 | - } |
|
136 | - return $code; |
|
128 | + $code = ""; |
|
129 | + foreach ($data as $key => $value) { |
|
130 | + $selected_tag = ""; |
|
131 | + if ($selected == $value) { |
|
132 | + $selected_tag = " selected='selected' "; |
|
133 | + } |
|
134 | + $code .= "<option value='$key' $selected_tag>$value</option>\r\n"; |
|
135 | + } |
|
136 | + return $code; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | function js_redirect_to($action, $seconds = 0.01) |
140 | 140 | { |
141 | - $seconds *= 1000; |
|
142 | - return "<script type=\"text/javascript\">setTimeout('window.location=\"?/$action\"', $seconds)</script>"; |
|
141 | + $seconds *= 1000; |
|
142 | + return "<script type=\"text/javascript\">setTimeout('window.location=\"?/$action\"', $seconds)</script>"; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | function button_to_action($caption, $action, $attributes = '') |
146 | 146 | { |
147 | - return "<button type='button' $attributes onclick='window.location=\"" . PUBLIC_PATH . "$action\"'>$caption</button>"; |
|
147 | + return "<button type='button' $attributes onclick='window.location=\"" . PUBLIC_PATH . "$action\"'>$caption</button>"; |
|
148 | 148 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | return "<label for='$field' $attributes>$caption</label>\r\n"; |
99 | 99 | } |
100 | 100 | |
101 | -function select_tag($name = '', $options='', $include_blank = false, $attributes = '') |
|
101 | +function select_tag($name = '', $options = '', $include_blank = false, $attributes = '') |
|
102 | 102 | { |
103 | 103 | list($id, $name) = get_field_name_and_id($name); |
104 | 104 |