function get_shorter_catalog_year_range

6.x misc.inc get_shorter_catalog_year_range($cat_range, $abbr_first = true, $abbr_second = true)
7.x misc.inc get_shorter_catalog_year_range($cat_range, $abbr_first = true, $abbr_second = true)
4.x misc.inc get_shorter_catalog_year_range($cat_range, $abbr_first = true, $abbr_second = true)
5.x misc.inc get_shorter_catalog_year_range($cat_range, $abbr_first = true, $abbr_second = true)

This is used usually when being viewed by a mobile device. It will shorten a catalog year range of 2008-2009 to just "08-09" or "2008-09" or even "09-2009".

Parameters

string $cat_range - Ex: 2006-2007:

File

includes/misc.inc, line 2633
This file contains misc functions for FlightPath

Code

function get_shorter_catalog_year_range($cat_range, $abbr_first = true, $abbr_second = true) {

  $temp = explode("-", $cat_range);

  $first = $temp [0];
  $second = $temp [1];

  if ($abbr_first) {
    $first = substr($first, 2, 2);
  }
  if ($abbr_second) {
    $second = substr($second, 2, 2);
  }

  return "$first-$second";
}