You are here

opigno_calendar_app.module in Opigno Calendar App 7

Module file. Defines module hooks.

File

opigno_calendar_app.module
View source
<?php

/**
 * @file
 * Module file. Defines module hooks.
 */

/**
 * Implements hook_views_api().
 */
function opigno_calendar_app_views_api() {
  return array(
    'api' => '3.0',
  );
}

/**
 * Implements hook_menu_local_tasks_alter().
 */
function opigno_calendar_app_menu_local_tasks_alter(&$data, $router_item, $root_path) {
  if (preg_match('/^opigno-calendar/', $root_path)) {
    $item = menu_get_item('node/add/calendar-event');
    if ($item['access']) {
      $item['title'] = t("Add a new event");
      $item['options']['attributes']['class'][] = $item['localized_options']['attributes']['class'][] = 'opigno-calendar-app-add-calendar-event';
      $data['actions']['output'][] = array(
        '#theme' => 'menu_local_action',
        '#link' => $item,
      );
    }
  }
}
function opigno_calendar_app_get_node_duration($node) {
  if (isset($node->opigno_calendar_date[LANGUAGE_NONE][0]['value']) && isset($node->opigno_calendar_date[LANGUAGE_NONE][0]['value2'])) {
    return strtotime($node->opigno_calendar_date[LANGUAGE_NONE][0]['value2']) - strtotime($node->opigno_calendar_date[LANGUAGE_NONE][0]['value']);
  }
  return 0;
}