You are here

function pmteam_load in Drupal PM (Project Management) 7

Implements hook_load().

File

pmteam/pmteam.module, line 247
Functionality for the Project Management Team module Organized into the following sections:

Code

function pmteam_load($nodes) {
  foreach ($nodes as $nid => &$node) {
    $team_query = db_select('node', 'n');
    $team_query
      ->join('pmteam', 'ste', 'n.nid = ste.mnid');
    $team_result = $team_query
      ->fields('n', array(
      'title',
      'status',
    ))
      ->fields('ste', array(
      'mnid',
    ))
      ->condition('ste.vid', $node->vid)
      ->execute();
    $node->members_array = array();
    $node->members_deactivated_array = array();
    foreach ($team_result as $members) {
      $node->members_array[$members->mnid] = $members->title;
      if ($members->status == 0) {
        $node->members_deactivated_array[$members->mnid] = $members->title;
      }
    }
    $node->title_old = $node->title;
  }
}