summaryrefslogtreecommitdiffstats
path: root/system/helpers/date_helper.php
diff options
context:
space:
mode:
authorMat Whitney <mwhitney@mail.sdsu.edu>2012-06-22 21:02:10 +0200
committerMat Whitney <mwhitney@mail.sdsu.edu>2012-06-22 21:02:10 +0200
commit7540dede0f01acd7aa1ffd224defc5189305a815 (patch)
tree5fa4b5bdb9f187eb08667ddb139b431f30a75c11 /system/helpers/date_helper.php
parent78fb6f0bdaacb751f7417daae02f66ef965cadbc (diff)
Added optional fourth parameter to timezone_menu
allows setting one or more attributes on the generated select tag. This allows passing attributes needed for Section 508 compliance ยง 1194.22(n), such as an id. http://access-board.gov/sec508/guide/1194.22.htm#(n) http://www.w3.org/TR/WCAG10-HTML-TECHS/#forms-labels
Diffstat (limited to 'system/helpers/date_helper.php')
-rw-r--r--system/helpers/date_helper.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index cafb6ba95..fc790c585 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -547,9 +547,10 @@ if ( ! function_exists('timezone_menu'))
* @param string timezone
* @param string classname
* @param string menu name
+ * @param mixed attributes
* @return string
*/
- function timezone_menu($default = 'UTC', $class = '', $name = 'timezones')
+ function timezone_menu($default = 'UTC', $class = '', $name = 'timezones', $attributes = '')
{
$CI =& get_instance();
$CI->lang->load('date');
@@ -563,7 +564,22 @@ if ( ! function_exists('timezone_menu'))
$menu .= ' class="'.$class.'"';
}
- $menu .= ">\n";
+ // Generate a string from the attributes submitted, if any
+ if (is_array($attributes))
+ {
+ $atts = '';
+ foreach ($attributes as $key => $val)
+ {
+ $atts .= ' '.$key.'="'.$val.'"';
+ }
+ $attributes = $atts;
+ }
+ elseif (is_string($attributes) && strlen($attributes) > 0)
+ {
+ $attributes = ' '.$attributes;
+ }
+
+ $menu .= $attributes.">\n";
foreach (timezones() as $key => $val)
{