function library_duedates_enabled in Library 7
Same name and namespace in other branches
- 5.2 library.module \library_duedates_enabled()
- 6.2 library.module \library_duedates_enabled()
- 6 library.module \library_duedates_enabled()
Check to see if due dates are enabled for any content types.
Parameters
null|string $type: Content type to check.
Return value
bool Whether one or more content type has due dates.
5 calls to library_duedates_enabled()
- library_cron in ./library.module 
- Implements hook_cron().
- library_history in ./library.pages.inc 
- A menu callback to show the transaction history of a single node.
- library_history_single_user in ./library.pages.inc 
- The menu callback to show the transaction history of a single user.
- library_notify_overdue in ./library.admin.inc 
- Send email to patrons with overdue items.
- library_overdue_items in ./library.pages.inc 
- Computes all overdue items.
File
- ./library.module, line 827 
Code
function library_duedates_enabled($type = NULL) {
  if (is_null($type)) {
    $duedates = 0;
    foreach (library_get_item_types() as $type) {
      if ($duedates == 0) {
        $duedates = variable_get('library_' . $type . '_due_dates', 0);
        if ($duedates > 0) {
          return TRUE;
        }
      }
      else {
        return TRUE;
      }
    }
    return FALSE;
  }
  else {
    $duedates = variable_get('library_' . $type . '_due_dates', 0);
    return $duedates > 0;
  }
}