You are here

function availability_calendars_nodeapi in Availability Calendars 5

Same name and namespace in other branches
  1. 6.2 availability_calendars.module \availability_calendars_nodeapi()
  2. 6 availability_calendars.module \availability_calendars_nodeapi()

Implementation hook node_nodeapi();

File

./availability_calendars.module, line 468
Availability Calendars Module

Code

function availability_calendars_nodeapi(&$node, $op, $a3 = null, $a4 = null) {
  global $user;
  if (!availability_calendars_enabled($node->type)) {
    return;
  }
  switch ($op) {
    case 'view':
      if (variable_get('availability_calendars_display_nodeview', TRUE)) {
        $year = date('Y');
        $month = date('m');
        $monthstodisplay = variable_get('availability_calendars_display_monthcount', 12);
        $node->content['availability_calendars'] = array(
          '#value' => theme('availability_calendars_node', $node, $year, $month, $monthstodisplay),
          '#weight' => 10,
        );
      }
      break;
    case 'insert':
    case 'update':
      availability_calendars_save($node);
      break;
    case 'delete':
      break;
  }
}