You are here

function clock_info in Clock 7.2

Returns information about all clocks or a single clock.

Parameters

$cid: (optional) The clock ID.

Return value

An associative array keyed by clock id containing clock objects. Each clock object has the following properties:

  • cid: The clock id.
  • display: A string that defines the display of the clock. Can contain tokens, most importantly:

    • [clock:date]: The correctly formatted date of the clock.
    • [clock:time-zone]: The time zone of the clock.
    • [clock:date-type]: The date type of the clock.
  • time_zone_type: The time zone type of the clock. Can be 'user', 'site', 'local', or 'custom'.
  • custom_time_zone: The custom time zone of the clock. This will only be displayed if the time zone type is 'custom'.
  • date_type: The date type of the clock. Can be any of the date types provided by core ('long', 'medium' and 'short') any date types provided by contributed modules via hook_date_format_types() or any date types added through the administrative interface at admin/config/regional/date-time.
  • weight: The weight of the clock. Clocks with higher weights sink to the bottom.

If $cid was specified, only a single clock object.

7 calls to clock_info()
ClockBlockTestCase::testClockBlock in ./clock.test
clock_block_configure in ./clock.module
Implements hook_block_configure().
clock_block_save in ./clock.module
Implements hook_block_save().
clock_block_view in ./clock.module
Implements hook_block_view().
clock_edit_form_submit in ./clock.admin.inc
Form submission handler for clock_edit_form().

... See full list

File

./clock.module, line 469
Display clocks on your site.

Code

function clock_info($cid = NULL) {
  $result = db_query("SELECT cid, time_zone_type, custom_time_zone, date_type, display, weight FROM {clock_settings} ORDER BY weight ASC");
  $info = array();
  foreach ($result as $row) {
    $info[$row->cid] = $row;
  }
  if (!empty($cid)) {
    $info = $info[$cid];
  }
  return $info;
}