function availability_calendars_nodeapi in Availability Calendars 6
Same name and namespace in other branches
- 5 availability_calendars.module \availability_calendars_nodeapi()
- 6.2 availability_calendars.module \availability_calendars_nodeapi()
Implementation hook node_nodeapi().
@global object $user
Parameters
object $node:
string $op:
string $a3:
string $a4:
File
- ./
availability_calendars.module, line 786 - Availability Calendars Module.
Code
function availability_calendars_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
global $user;
$settings = availability_calendar_getsettings('node', $node->nid);
if ($settings->system->status[$node->type] === 0) {
return;
}
switch ($op) {
case 'view':
if ($settings->system->nodeview === 1 && !$a3 || $settings->system->nodeview === 1 && $a3 && ($settings->system->showteaser === 1 || $settings->system->showteaser === 0 && $settings->showteaser === 1)) {
$year = date('Y');
$month = date('m');
$calendar_node = $node;
if ($node->tnid) {
// if Content Translation module is enabled and this is a translated node, use calendar of original node
if ($node->tnid != $node->nid) {
$calendar_node = node_load($node->tnid);
}
}
$node->content['availability_calendars'] = array(
'#value' => theme('availability_calendars_node', $calendar_node, $year, $month, $settings->system->monthcount),
'#weight' => 10,
);
}
break;
case 'insert':
case 'update':
availability_calendars_save($node);
break;
case 'delete':
break;
}
}