theme.inc

  1. cis7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  2. cis7 sites/all/themes/local_contrib/zurb-foundation/inc/theme.inc
  3. cis7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  4. cis7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  5. cis7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  6. cis7 sites/all/modules/ulmus/features/theme/theme.inc
  7. cis7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  8. cis7 sites/all/modules/ulmus/views/theme/theme.inc
  9. cis7 sites/all/modules/local_contrib/views_fluid_grid/theme/theme.inc
  10. cis7 sites/all/themes/ulmus/aurora/includes/theme.inc
  11. cis7 includes/theme.inc
  12. cis7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  13. cle7 sites/all/themes/local_contrib/bootstrap/includes/theme.inc
  14. cle7 sites/all/themes/ulmus/aurora/includes/theme.inc
  15. cle7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  16. cle7 sites/all/modules/ulmus/features/theme/theme.inc
  17. cle7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  18. cle7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  19. cle7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  20. cle7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  21. cle7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  22. cle7 sites/all/modules/ulmus/views/theme/theme.inc
  23. cle7 includes/theme.inc
  24. cle7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  25. cle7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  26. ecd7 sites/all/modules/ulmus/features/theme/theme.inc
  27. ecd7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  28. ecd7 sites/all/themes/ulmus/aurora/includes/theme.inc
  29. ecd7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  30. ecd7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  31. ecd7 includes/theme.inc
  32. ecd7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  33. ecd7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  34. ecd7 sites/all/modules/ulmus/views/theme/theme.inc
  35. ecd7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  36. ecd7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  37. elmsmedia7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  38. elmsmedia7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  39. elmsmedia7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  40. elmsmedia7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  41. elmsmedia7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  42. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  43. elmsmedia7 sites/all/modules/ulmus/features/theme/theme.inc
  44. elmsmedia7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  45. elmsmedia7 sites/all/modules/local_contrib/views_fluid_grid/theme/theme.inc
  46. elmsmedia7 sites/all/themes/ulmus/aurora/includes/theme.inc
  47. elmsmedia7 includes/theme.inc
  48. elmsmedia7 sites/all/modules/ulmus/views/theme/theme.inc
  49. harmony7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  50. harmony7 sites/all/themes/ulmus/aurora/includes/theme.inc
  51. harmony7 sites/all/modules/local_contrib/harmony_core/theme/theme.inc
  52. harmony7 includes/theme.inc
  53. harmony7 sites/all/modules/ulmus/views/theme/theme.inc
  54. harmony7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  55. harmony7 sites/all/modules/ulmus/features/theme/theme.inc
  56. harmony7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  57. harmony7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  58. harmony7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  59. harmony7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  60. harmony7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  61. icor7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  62. icor7 sites/all/modules/ulmus/views/theme/theme.inc
  63. icor7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  64. icor7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  65. icor7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  66. icor7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  67. icor7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  68. icor7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  69. icor7 sites/all/themes/ulmus/aurora/includes/theme.inc
  70. icor7 includes/theme.inc
  71. icor7 sites/all/modules/ulmus/features/theme/theme.inc
  72. meedjum_blog7 sites/all/modules/ulmus/date/date_views/theme/theme.inc
  73. meedjum_blog7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  74. meedjum_blog7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  75. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  76. meedjum_blog7 sites/all/modules/ulmus/features/theme/theme.inc
  77. meedjum_blog7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  78. meedjum_blog7 sites/all/themes/ulmus/aurora/includes/theme.inc
  79. meedjum_blog7 sites/all/modules/ulmus/views/theme/theme.inc
  80. meedjum_blog7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  81. meedjum_blog7 includes/theme.inc
  82. meedjum_blog7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  83. mooc7 sites/all/modules/ulmus/date/date_api/theme/theme.inc
  84. mooc7 includes/theme.inc
  85. mooc7 sites/all/themes/ulmus/aurora/includes/theme.inc
  86. mooc7 sites/all/modules/ulmus/views/theme/theme.inc
  87. mooc7 sites/all/modules/ulmus/field_collection_table/theme/theme.inc
  88. mooc7 sites/all/modules/ulmus/features/theme/theme.inc
  89. mooc7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/theme.inc
  90. mooc7 sites/all/modules/ulmus/ctools/plugins/access/theme.inc
  91. mooc7 sites/all/modules/ulmus/context/context_ui/theme/theme.inc
  92. mooc7 sites/all/themes/local_contrib/zurb_foundation/inc/theme.inc
  93. mooc7 sites/all/modules/ulmus/date/date_views/theme/theme.inc

Theme files for Date API.

Functions

Namesort descending Description
theme_date_calendar_day Returns HTML for a date block that looks like a mini calendar day.
theme_date_part_hour_prefix Returns HTML for a 'hour' date part prefix.
theme_date_part_label_ampm Returns HTML for a date_select 'ampm' label.
theme_date_part_label_date Returns HTML for a date_select 'date' label.
theme_date_part_label_day Returns HTML for a date_select 'day' label.
theme_date_part_label_hour Returns HTML for a date_select 'hour' label.
theme_date_part_label_minute Returns HTML for a date_select 'minute' label.
theme_date_part_label_month Returns HTML for a date_select 'month' label.
theme_date_part_label_second Returns HTML for a date_select 'second' label.
theme_date_part_label_time Returns HTML for a date_select 'time' label.
theme_date_part_label_timezone Returns HTML for a date_select 'timezone' label.
theme_date_part_label_year Returns HTML for a date_select 'year' label.
theme_date_part_minsec_prefix Returns HTML for a 'minutes and seconds' date part prefix.
theme_date_select Returns HTML for a date select element.
theme_date_select_element Returns HTML for a date select input form element.
theme_date_text Returns HTML for a date text element.
theme_date_textfield_element Returns HTML for a date textfield input form element.
theme_date_timezone Returns HTML for a date timezone element.
theme_date_time_ago Returns HTML for a date in the format 'time ago'.

File

sites/all/modules/ulmus/date/date_api/theme/theme.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Theme files for Date API.
  5. */
  6. /**
  7. * Returns HTML for a date timezone element.
  8. */
  9. function theme_date_timezone($variables) {
  10. $element = $variables['element'];
  11. $attributes = $element['#attributes'];
  12. $wrapper_attributes = array();
  13. // Add an wrapper to mimic the way a single value field works, for ease in
  14. // using #states.
  15. if (isset($element['#children'])) {
  16. $element['#children'] = '<div id="' . $element['#id'] . '" ' . drupal_attributes($wrapper_attributes) . '>' . $element['#children'] . '</div>';
  17. }
  18. return '<div ' . drupal_attributes($attributes) . '>' . theme('form_element', $element) . '</div>';
  19. }
  20. /**
  21. * Returns HTML for a date select element.
  22. */
  23. function theme_date_select($variables) {
  24. $element = $variables['element'];
  25. $attributes = !empty($element['#wrapper_attributes']) ? $element['#wrapper_attributes'] : array('class' => array());
  26. $attributes['class'][] = 'container-inline-date';
  27. $wrapper_attributes = array('class' => array('date-padding'));
  28. $wrapper_attributes['class'][] = 'clearfix';
  29. // Add an wrapper to mimic the way a single value field works, for ease in
  30. // using #states.
  31. if (isset($element['#children'])) {
  32. $element['#children'] = '<div id="' . $element['#id'] . '" ' . drupal_attributes($wrapper_attributes) . '>' . $element['#children'] . '</div>';
  33. }
  34. return '<div ' . drupal_attributes($attributes) . '>' . theme('form_element', $element) . '</div>';
  35. }
  36. /**
  37. * Returns HTML for a date text element.
  38. */
  39. function theme_date_text($variables) {
  40. $element = $variables['element'];
  41. $attributes = !empty($element['#wrapper_attributes']) ? $element['#wrapper_attributes'] : array('class' => array());
  42. $attributes['class'][] = 'container-inline-date';
  43. // If there is no description, the floating date elements need some extra
  44. // padding below them.
  45. $wrapper_attributes = array('class' => array('date-padding'));
  46. if (empty($element['date']['#description'])) {
  47. $wrapper_attributes['class'][] = 'clearfix';
  48. }
  49. // Add an wrapper to mimic the way a single value field works, for ease in
  50. // using #states.
  51. if (isset($element['#children'])) {
  52. $element['#children'] = '<div id="' . $element['#id'] . '" ' . drupal_attributes($wrapper_attributes) . '>' . $element['#children'] . '</div>';
  53. }
  54. return '<div ' . drupal_attributes($attributes) . '>' . theme('form_element', $element) . '</div>';
  55. }
  56. /**
  57. * Returns HTML for a date select input form element.
  58. */
  59. function theme_date_select_element($variables) {
  60. $element = $variables['element'];
  61. $parents = $element['#parents'];
  62. $part = array_pop($parents);
  63. return '<div class="date-' . $part . '">' . theme('select', $element) . '</div>';
  64. }
  65. /**
  66. * Returns HTML for a date textfield input form element.
  67. */
  68. function theme_date_textfield_element($variables) {
  69. $element = $variables['element'];
  70. $parents = $element['#parents'];
  71. $part = array_pop($parents);
  72. return '<div class="date-' . $part . '">' . theme('textfield', $element) . '</div>';
  73. }
  74. /**
  75. * Returns HTML for a 'hour' date part prefix.
  76. */
  77. function theme_date_part_hour_prefix($variables) {
  78. $element = $variables['element'];
  79. if ($element['#date_label_position'] != 'above') {
  80. return '<span class="form-item date-spacer">&nbsp;-&nbsp;</span>';
  81. }
  82. }
  83. /**
  84. * Returns HTML for a 'minutes and seconds' date part prefix.
  85. */
  86. function theme_date_part_minsec_prefix($variables) {
  87. $element = $variables['element'];
  88. if ($element['#date_label_position'] != 'above') {
  89. return '<span class="form-item date-spacer">:</span>';
  90. }
  91. }
  92. /**
  93. * Returns HTML for a date_select 'year' label.
  94. */
  95. function theme_date_part_label_year($variables) {
  96. return t('Year', array(), array('context' => 'datetime'));
  97. }
  98. /**
  99. * Returns HTML for a date_select 'month' label.
  100. */
  101. function theme_date_part_label_month($variables) {
  102. return t('Month', array(), array('context' => 'datetime'));
  103. }
  104. /**
  105. * Returns HTML for a date_select 'day' label.
  106. */
  107. function theme_date_part_label_day($variables) {
  108. return t('Day', array(), array('context' => 'datetime'));
  109. }
  110. /**
  111. * Returns HTML for a date_select 'hour' label.
  112. */
  113. function theme_date_part_label_hour($variables) {
  114. return t('Hour', array(), array('context' => 'datetime'));
  115. }
  116. /**
  117. * Returns HTML for a date_select 'minute' label.
  118. */
  119. function theme_date_part_label_minute($variables) {
  120. return t('Minute', array(), array('context' => 'datetime'));
  121. }
  122. /**
  123. * Returns HTML for a date_select 'second' label.
  124. */
  125. function theme_date_part_label_second($variables) {
  126. return t('Second', array(), array('context' => 'datetime'));
  127. }
  128. /**
  129. * Returns HTML for a date_select 'ampm' label.
  130. */
  131. function theme_date_part_label_ampm($variables) {
  132. return '&nbsp;';
  133. }
  134. /**
  135. * Returns HTML for a date_select 'timezone' label.
  136. */
  137. function theme_date_part_label_timezone($variables) {
  138. return t('Timezone');
  139. }
  140. /**
  141. * Returns HTML for a date_select 'date' label.
  142. */
  143. function theme_date_part_label_date($variables) {
  144. return t('Date', array(), array('context' => 'datetime'));
  145. }
  146. /**
  147. * Returns HTML for a date_select 'time' label.
  148. */
  149. function theme_date_part_label_time($variables) {
  150. return t('Time', array(), array('context' => 'datetime'));
  151. }
  152. /**
  153. * Returns HTML for a date block that looks like a mini calendar day.
  154. *
  155. * Pass in a date object already set to the right timezone, format as a calendar
  156. * page date. The calendar styling is created in CSS.
  157. */
  158. function theme_date_calendar_day($variables) {
  159. $output = '';
  160. $date = $variables['date'];
  161. if (!empty($date)) {
  162. $output .= '<div class="date-calendar-day">';
  163. $output .= '<span class="month">' . date_format_date($date, 'custom', 'M') . '</span>';
  164. $output .= '<span class="day">' . date_format_date($date, 'custom', 'j') . '</span>';
  165. $output .= '<span class="year">' . date_format_date($date, 'custom', 'Y') . '</span>';
  166. $output .= '</div>';
  167. }
  168. return $output;
  169. }
  170. /**
  171. * Returns HTML for a date in the format 'time ago'.
  172. */
  173. function theme_date_time_ago($variables) {
  174. $start_date = $variables['start_date'];
  175. $end_date = $variables['end_date'];
  176. $interval = !empty($variables['interval']) ? $variables['interval'] : 2;
  177. $display = isset($variables['interval_display']) ? $variables['interval_display'] : 'time ago';
  178. // If no date is sent, then return nothing.
  179. if (empty($start_date) || empty($end_date)) {
  180. return;
  181. }
  182. // Time to compare dates to.
  183. $now = date_format(date_now(), DATE_FORMAT_UNIX);
  184. $start = date_format($start_date, DATE_FORMAT_UNIX);
  185. // will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence)
  186. $time_diff = $now - $start;
  187. // Uses the same options used by Views format_interval.
  188. switch ($display) {
  189. case 'raw time ago':
  190. return format_interval($time_diff, $interval);
  191. case 'time ago':
  192. return t('%time ago', array('%time' => format_interval($time_diff, $interval)));
  193. case 'raw time hence':
  194. return format_interval(-$time_diff, $interval);
  195. case 'time hence':
  196. return t('%time hence', array('%time' => format_interval(-$time_diff, $interval)));
  197. case 'raw time span':
  198. return ($time_diff < 0 ? '-' : '') . format_interval(abs($time_diff), $interval);
  199. case 'inverse time span':
  200. return ($time_diff > 0 ? '-' : '') . format_interval(abs($time_diff), $interval);
  201. case 'time span':
  202. return t(($time_diff < 0 ? '%time hence' : '%time ago'), array('%time' => format_interval(abs($time_diff), $interval)));
  203. }
  204. }