function _resource_conflict_get_node_resource_demand in Resource Conflict 6.2
Same name and namespace in other branches
- 5.2 resource_conflict.module \_resource_conflict_get_node_resource_demand()
- 7.2 resource_conflict.module \_resource_conflict_get_node_resource_demand()
Get a conflict enabled node's resource demand
Parameters
$node: The node which resurce demand will be returned
Return value
An array with keys of the node ID's, values of true
1 call to _resource_conflict_get_node_resource_demand()
- _resource_conflict_display_conflict_errors in ./
resource_conflict.module - Compare our demand to the demand of overlapping nodes and display errors for the intersections
File
- ./
resource_conflict.module, line 297
Code
function _resource_conflict_get_node_resource_demand($node) {
$type = $node->type;
$reference_fields = variable_get('rc_reference_fields_' . $type, array());
$demand = array();
foreach ($reference_fields as $reference_field) {
$references = $node->{$reference_field};
foreach ($references as $reference) {
/**
* Check to see if any referencable resources exist. If they don't, file
* an error. This only matters when the nodereference field is set to
* required, otherwise this code doesn't get called at all. We have to
* file the error against the fake 'no_resources' element as CCK files
* it's own "Illegal choice" error before we get called.
*/
if (is_array($reference['nid'])) {
form_set_error('no_resources', t('No bookable resources have been created. Please create resources to book before attempting to create a resource booking.'));
}
else {
if (is_numeric($reference['nid'])) {
$demand[$reference['nid']] = TRUE;
}
}
}
}
return $demand;
}