You are here

function theme_support_pm_pager in Support Ticketing System 7

Same name and namespace in other branches
  1. 6 support_pm/support_pm.module \theme_support_pm_pager()

Helper function to show previous and next weeks.

2 theme calls to theme_support_pm_pager()
support_pm_plan_overview_weekly in support_pm/support_pm.module
theme_support_pm_user_week in support_pm/support_pm.module
TODO: Auto-calculate totals whenever a field is updated.

File

support_pm/support_pm.module, line 880
Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support

Code

function theme_support_pm_pager($variables) {
  $text = $variables['text'];
  $op = $variables['op'];
  $parameters = $variables['parameters'];
  $attributes = $variables['attributes'];
  $first_day = isset($_GET['week']) ? _support_pm_first_day((int) $_GET['week']) : _support_pm_first_day(time());
  $week = $first_day;
  $prepend = $append = '';
  switch ($op) {
    case '<':
      $week -= 86400 * 7;
      $prepend = '‹ ';
      break;
    case '>':
      $week += 86400 * 7;
      $append = ' ›';
      break;
    default:
      $append = '';
      $prepend = '';
      break;
  }
  $dates = t('@start - @end', array(
    '@start' => format_date($week, 'medium'),
    '@end' => format_date($week + 86400 * 6, 'medium'),
  ));
  $text = t('@prepend@dates@append', array(
    '@prepend' => $prepend,
    '@dates' => $dates,
    '@append' => $append,
  ));
  $query = array();
  if (!isset($parameters['week'])) {
    $parameters['week'] = $week;
  }
  if (!isset($attributes['title'])) {
    $attributes['title'] = t('View plan for week of @week', array(
      '@week' => $dates,
    ));
  }
  return l($text, $_GET['q'], array(
    'attributes' => $attributes,
    'query' => $parameters,
  ));
}