You are here

function patron_list_patrons in Library 6

Same name and namespace in other branches
  1. 5.2 patron/patron.pages.inc \patron_list_patrons()

@file Functions for generating page displays related to the patron module

1 string reference to 'patron_list_patrons'
patron_menu in patron/patron.module
Implementation of hook_menu()

File

patron/patron.pages.inc, line 9
Functions for generating page displays related to the patron module

Code

function patron_list_patrons() {
  $patrons = patron_get_patrons('all');
  if ($patrons) {
    $header = array(
      t('Name'),
      t('Status'),
    );
    $header[] = t('Actions');
    $rows = array();
    foreach ($patrons as $patron) {
      if ($patron->disabled == PATRON_DISABLED) {
        $patron->disabled = 'Disabled';
      }
      else {
        $patron->disabled = 'Active';
      }
      $rows[] = array(
        $patron->name_last . ', ' . $patron->name_first,
        $patron->disabled,
        l('View', 'node/' . $patron->nid) . ' | ' . patron_email_link($patron),
      );
    }
    return theme('table', $header, $rows);
  }
  else {
    return "<p>No patrons found.</p>";
  }
}