a tiny mvc framework for php using php-activerecord
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

implement time_zone_select() and time_zone_select_tag()

+36
+12
lib/helpers/form_common.php
··· 103 103 return $opts_s; 104 104 } 105 105 106 + /* generate <option> tags for each identifier in php's timezone list */ 107 + protected function time_zone_options_for_select($selected) { 108 + $str = ""; 109 + 110 + foreach (\DateTimeZone::listIdentifiers() as $tz) 111 + $str .= "<option value=\"" . $tz . "\"" 112 + . (strtolower($selected) === strtolower($tz) ? 113 + " selected" : "") . ">" . h($tz) . "</option>"; 114 + 115 + return $str; 116 + } 117 + 106 118 /* for each attribute in a form_for() object that has errors, output a div 107 119 * around it that should be styled to stand out */ 108 120 protected function wrap_field_with_errors($field, $field_html) {
+14
lib/helpers/form_helper.php
··· 213 213 $options), $options) 214 214 ); 215 215 } 216 + 217 + /* create a <select> of grouped time zones */ 218 + public function time_zone_select($field, $options = array()) { 219 + if (!$this->form_object) 220 + throw new HalfMoonException("no form object; you probably wanted " 221 + . "time_zone_select_tag"); 222 + 223 + $options = $this->set_field_id_and_name($field, $options); 224 + 225 + return $this->wrap_field_with_errors($field, 226 + $this->time_zone_select_tag($field, 227 + $this->value_for_field($field, $options), $options) 228 + ); 229 + } 216 230 } 217 231 218 232 ?>
+10
lib/helpers/form_tag_helper.php
··· 170 170 171 171 return "<input" . $this->options_to_s($options) . " />"; 172 172 } 173 + 174 + /* create a <select> of grouped time zones */ 175 + public function time_zone_select_tag($field, $selected = null, 176 + $options = array()) { 177 + $options = FormTagHelper::set_field_id_and_name($field, $options); 178 + 179 + return "<select" . $this->options_to_s($options) . ">" 180 + . $this->time_zone_options_for_select($selected) 181 + . "</select>"; 182 + } 173 183 } 174 184 175 185 ?>