You are here

function pm_dashboard in Drupal PM (Project Management) 7

Same name and namespace in other branches
  1. 7.2 pm.module \pm_dashboard()

Function to create a dashboard (call to theme function)

Parameters

string $type: Dashboard type, used for pm_get_dashboard_links

Return value

string Themed string

1 call to pm_dashboard()
pm_block_view in ./pm.module
Implements hook_block_view().
2 string references to 'pm_dashboard'
pm_menu in ./pm.module
Implements hook_menu().
pm_pm_dashboard_types in ./pm.module
Implements hook_pm_dashboard_types().

File

./pm.module, line 213
Main module file for the Project Management module.

Code

function pm_dashboard($type = 'page') {
  $types = module_invoke_all('pm_dashboard_types');

  // only set Page Title if it has a url, so there is a menu entry for that
  // The block type has no url and shouldn't change the title!
  if (isset($types[$type]['url']) && isset($types[$type]['title'])) {
    drupal_set_title($types[$type]['title']);
  }
  drupal_add_css(drupal_get_path('module', 'pm') . '/pm-dashboard.css');
  $link_blocks = pm_dashboard_get_links(TRUE, $type);
  if (!empty($link_blocks)) {

    // DIVIDE LINKS INTO TWO BLOCKS
    $count = ceil(count($link_blocks) / 2);
    $link_blocks = array_chunk($link_blocks, $count);
  }
  $theme = isset($types[$type]['theme']) ? $types[$type]['theme'] : 'pm_dashboard';
  $content = theme($theme, $link_blocks);
  return $content;
}