Index: trunk/extensions/SemanticDrilldown/includes/SD_Utils.php |
— | — | @@ -71,97 +71,103 @@ |
72 | 72 | $field_count++; |
73 | 73 | $sd_array = $field->getObject('Filter');//this returns an array with property values filled |
74 | 74 | $filter_array = $sd_array['sd']; |
75 | | - $html_text .= <<<END |
76 | | - <p>$name_label <input size="25" name="sd_filter_name_starter" value="$filter_array[Label]" ></p> |
77 | | -END; |
78 | | - $html_text .= <<<END |
79 | | - |
80 | | - <p><input type="radio" name="sd_values_source_starter" checked value="property"> |
81 | | - $values_from_property_label |
82 | | - </p> |
83 | | -END; |
84 | | - //wfDebugLog( 'myextension', 'Something is not right: ' . print_r( $html_text, true ) ); |
| 75 | + $html_text .= '<p>$name_label <input size="25" name="sd_filter_name_starter" value="'.$filter_array['Label'].'" ></p>'; |
| 76 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="property">'. |
| 77 | + $values_from_property_label.' |
| 78 | + </p>'; |
85 | 79 | $categories = SDUtils::getTopLevelCategories(); |
86 | 80 | $option_html_text = ""; |
87 | | - foreach ( $categories as $category ) { |
88 | | - $category = str_replace( '_', ' ', $category ); |
89 | | - $option_html_text .= " <option>$category</option>\n"; |
90 | | - } |
91 | | - if( $filter_array['ValuesFromCategory'] != null){ |
92 | | - $html_text .= ' |
93 | | - <p><input type="radio" name="sd_values_source_starter" checked value="category">'. |
94 | | - $values_from_category_label.' |
95 | | - <select id="category_dropdown" name="sd_category_name_starter">'; |
96 | | - $option_html_text = ""; |
97 | 81 | foreach ( $categories as $category ) { |
98 | 82 | $category = str_replace( '_', ' ', $category ); |
99 | | - if( $category == $filter_array["ValuesFromCategory"]) { |
100 | | - $option_html_text .= ' <option selected>'.$category.'</option>\n'; |
101 | | - }else{ |
102 | | - $option_html_text .= ' <option>'.$category.'</option>\n'; |
| 83 | + $option_html_text .= " <option>$category</option>\n"; |
| 84 | + } |
| 85 | + if( $filter_array['ValuesFromCategory'] != null){ |
| 86 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="category">'. |
| 87 | + $values_from_category_label.' |
| 88 | + <select id="category_dropdown" name="sd_category_name_starter">'; |
| 89 | + $option_html_text = ""; |
| 90 | + foreach ( $categories as $category ) { |
| 91 | + $category = str_replace( '_', ' ', $category ); |
| 92 | + if( $category == $filter_array["ValuesFromCategory"]) { |
| 93 | + $option_html_text .= ' <option selected>'.$category.'</option>\n'; |
| 94 | + }else{ |
| 95 | + $option_html_text .= ' <option>'.$category.'</option>\n'; |
| 96 | + } |
103 | 97 | } |
| 98 | + }else{ |
| 99 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="category">'. |
| 100 | + $values_from_category_label.' |
| 101 | + <select id="category_dropdown" name="sd_category_name_starter">'; |
104 | 102 | } |
| 103 | + $html_text .= $option_html_text; |
| 104 | + $html_text .= '</select></p>'; |
| 105 | + |
| 106 | + if( $filter_array["TimePeriod"] != null ){ |
| 107 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="dates">'. |
| 108 | + $date_values_label.' |
| 109 | + <select id="time_period_dropdown" name="sd_time_period_starter">'; |
| 110 | + |
| 111 | + if($filter_array['TimePeriod'] == $year_value ){ |
| 112 | + $html_text .= '<option selected value="'.$year_value.'">'.$year_label.'</option> |
| 113 | + <option value="'.$month_value.'">'.$month_label.'</option>'; |
| 114 | + }else{ |
| 115 | + $html_text .= '<option value="'.$year_value.'">'.$year_label.'</option> |
| 116 | + <option selected value="'.$month_value.'">'.$month_label.'</option>'; |
| 117 | + } |
| 118 | + |
| 119 | + $html_text .= '</select> |
| 120 | + </p>'; |
| 121 | + |
105 | 122 | }else{ |
106 | | - $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="category">'. |
107 | | - $values_from_category_label.' |
108 | | - <select id="category_dropdown" name="sd_category_name_starter">'; |
| 123 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="dates">'. |
| 124 | + $date_values_label.' |
| 125 | + <select id="time_period_dropdown" name="sd_time_period_starter"> |
| 126 | + <option value="'.$year_value.'">'.$year_label.'</option> |
| 127 | + <option value="'.$month_value.'">'.$month_label.'</option> |
| 128 | + </select> |
| 129 | + </p>'; |
109 | 130 | } |
110 | | - $html_text .= $option_html_text; |
111 | | - $html_text .= '</select></p>'; |
112 | | - |
113 | | - if( $filter_array["TimePeriod"] != null ){ |
114 | | - $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="dates">'. |
115 | | - $date_values_label.' |
116 | | - <select id="time_period_dropdown" name="sd_time_period_starter">'; |
117 | | - |
118 | | - if($filter_array['TimePeriod'] == $year_value ){ |
119 | | - $html_text .= '<option selected value="'.$year_value.'">'.$year_label.'</option> |
120 | | - <option value="'.$month_value.'">'.$month_label.'</option>'; |
| 131 | + if( $filter_array['Values'] != null){ |
| 132 | + $values_array = $filter_array['Values']; |
| 133 | + $values_str = ""; |
| 134 | + foreach($values_array as $value) |
| 135 | + { |
| 136 | + $values_str .= $value.', '; |
| 137 | + } |
| 138 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="manual">'. |
| 139 | + $enter_values_label.' <input size="40" name="sd_filter_values_starter" value=".'.$values_str.'" > |
| 140 | + </p>'; |
121 | 141 | }else{ |
122 | | - $html_text .= '<option value="'.$year_value.'">'.$year_label.'</option> |
123 | | - <option selected value="'.$month_value.'">'.$month_label.'</option>'; |
| 142 | + $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="manual">'. |
| 143 | + $enter_values_label.' <input size="40" name="sd_filter_values_starter" value=""> |
| 144 | + </p>'; |
124 | 145 | } |
125 | | - |
126 | | - $html_text .= '</select> |
127 | | - </p>'; |
128 | | - |
129 | | - }else{ |
130 | | - $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="dates">'. |
131 | | - $date_values_label.' |
132 | | - <select id="time_period_dropdown" name="sd_time_period_starter"> |
133 | | - <option value="'.$year_value.'">'.$year_label.'</option> |
134 | | - <option value="'.$month_value.'">'.$month_label.'</option> |
135 | | - </select> |
136 | | - </p>'; |
137 | | - } |
138 | | - if( $filter_array['Values'] != null){ |
139 | | - $values_array = $filter_array['Values']; |
140 | | - $values_str = ""; |
141 | | - foreach($values_array as $value) |
142 | | - { |
143 | | - $values_str .= $value.', '; |
144 | | - } |
145 | | - $html_text .= '<p><input type="radio" name="sd_values_source_starter" checked value="manual">'. |
146 | | - $enter_values_label.' <input size="40" name="sd_filter_values_starter" value=".'.$values_str.'" > |
147 | | - </p>'; |
148 | | - }else{ |
149 | | - $html_text .= '<p><input type="radio" name="sd_values_source_starter" value="manual">'. |
150 | | - $enter_values_label.' <input size="40" name="sd_filter_values_starter" value=""> |
151 | | - </p>'; |
152 | | - } |
153 | | - |
154 | | - $html_text .= '<p>'.$input_type_label.' |
155 | | - <select id="input_type_dropdown" name="sd_input_type_starter"> |
156 | | - <option value="">'.$values_list_label.'</option> |
157 | | - <option value="'.$combo_box_value.'">'.$combo_box_label.'</option> |
158 | | - <option value="'.$date_range_value.'">'.$date_range_label.'</option> |
159 | | - </select> |
160 | | - </p>'; |
161 | | - |
| 146 | + if( $filter_array['InputType'] != null){ |
| 147 | + $input_type_val = $filter_array['InputType']; |
| 148 | + $html_text .= '<p>'.$input_type_label.' |
| 149 | + <select id="input_type_dropdown" name="sd_input_type_starter"> |
| 150 | + <option selected value="">'.$values_list_label.'</option>'; |
| 151 | + if( $input_type_val == $combo_box_value){ |
| 152 | + $html_text .= '<option selected value="'.$combo_box_value.'">'.$combo_box_label.'</option> |
| 153 | + <option value="'.$date_range_value.'">'.$date_range_label.'</option> |
| 154 | + </select> |
| 155 | + </p>'; |
| 156 | + }else if( $input_type_val == $date_range_value ){ |
| 157 | + $html_text .= '<option value="'.$combo_box_value.'">'.$combo_box_label.'</option> |
| 158 | + <option selected value="'.$date_range_value.'">'.$date_range_label.'</option> |
| 159 | + </select> |
| 160 | + </p>'; |
| 161 | + }else{ |
| 162 | + $html_text .= '<option value="'.$combo_box_value.'">'.$combo_box_label.'</option> |
| 163 | + <option value="'.$date_range_value.'">'.$date_range_label.'</option> |
| 164 | + </select> |
| 165 | + </p>'; |
| 166 | + } |
| 167 | + } |
162 | 168 | $html_text_array[] = $html_text; |
163 | 169 | $html_text = ""; |
164 | | - } |
165 | 170 | } |
| 171 | + } |
166 | 172 | $text_extensions['sd'] = $html_text_array; |
167 | 173 | return true; |
168 | 174 | } |