You are here

pmorganization.module in Drupal PM (Project Management) 7.2

Main module file for PM Organization.

File

pmorganization/pmorganization.module
View source
<?php

/**
 * @file
 * Main module file for PM Organization.
 */

/**
 * Implements hook_help().
 */
function pmorganization_help($path, $arg) {
  $output = '';
  switch ($path) {
    case "admin/help#pmorganization":
      $output = '<p>' . t("Provides organization support for Project Management") . '</p>';
      break;
  }
  return $output;
}

/**
 * Implements hook_permission().
 */
function pmorganization_permission() {
  $name = 'Project Management Organization';
  return array(
    "Project Management Organization: access" => array(
      'title' => t('Access %type_name.', array(
        '%type_name' => $name,
      )),
      'description' => t('Allows the user to see pages and blocks associated with the %type_name, but does not control specific item that is shown within them.', array(
        '%type_name' => $name,
      )),
    ),
  );
}

/**
 * Implements hook_node_info().
 */
function pmorganization_node_info() {
  return array(
    'pmorganization' => array(
      'name' => t('Organization'),
      'base' => 'pmorganization',
      'description' => t('Use <em>organizations</em> for formal groups of people, such as clients/customers/service providers within <em>Project Management</em>.'),
      'title_label' => t('Name'),
      'body_label' => t('Description'),
    ),
  );
}

/**
 * Implements hook_form().
 */
function pmorganization_form($node, &$form_state) {
  $breadcrumb = array(
    l(t('Project Management'), 'pm'),
    l(t('Organizations'), 'pm/organizations'),
  );
  drupal_set_breadcrumb($breadcrumb);
  return node_content_form($node, $form_state);
}

/**
 * Implements hook_view().
 */
function pmorganization_view($node, $view_mode) {
  if ($view_mode == 'full' && node_is_page($node)) {
    $breadcrumb = array(
      l(t('Project Management'), 'pm'),
      l(t('Organizations'), 'pm/organizations'),
    );
    drupal_set_breadcrumb($breadcrumb);
  }
  return $node;
}

/**
 * Implements hook_views_api().
 */
function pmorganization_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'pmorganization'),
  );
}

/**
 * Implements hook_pm_dashboard_links().
 */
function pmorganization_pm_dashboard_links($type) {
  $links = array();
  if ($type == 'page' || $type == 'block') {
    $links[] = array(
      'theme' => 'pm_dashboard_link',
      'title' => t('Organizations'),
      'icon' => 'pmorganizations',
      'path' => 'pm/organizations',
      'params' => array(),
      'node_type' => 'pmorganization',
      'add_type' => 'pmorganization',
      'map' => array(),
      'weight' => 1,
    );
  }
  return $links;
}

/**
 * Implements hook_ctools_plugin_api().
 */
function pmorganization_ctools_plugin_api($module = NULL, $api = NULL) {
  if ($module == "field_group" && $api == "field_group") {
    return array(
      "version" => "1",
    );
  }
}