change to node load

This commit is contained in:
2016-05-27 10:51:49 +10:00
parent e236d67c3f
commit c707f90c97

View File

@@ -101,6 +101,44 @@ function _booking_node_create_mysqlview()
function booking_load_query($node_ids = NULL, $fetchAssoc = FALSE)
{
global $event;
//filter the results either by specific nodes if passed as a parameter or by all nodes matching the event id
if (! is_null($node_ids))
{
//$query = db_query("SELECT * FROM booking_person_view WHERE nid IN :nid", array(':nid' => $node_ids));
$query = db_query("SELECT * FROM booking_person_view WHERE nid IN (:nid)", array(':nid' => implode(',', $node_ids)));
//$query->condition('p.nid', $node_ids, 'IN');
}
else
{
$query = db_query("SELECT * FROM booking_person_view");
//$query->condition('p.booking_eventid', $event->eid, '=');
}
watchdog('booking_debug', "<pre>Loading node query:\n@info</pre>", array('@info' => print_r( (string)$query, true)));
//get the query result as either an associative array
if ($fetchAssoc == TRUE)
{
$result = $query->execute()->fetchAllAssoc('nid');
}
else
{
$result = $query->execute();
}
watchdog('booking', "<pre>Loading node query output:\n@info</pre>", array('@info' => print_r( $result, true)));
return $result;
}
/**
* Function to query the database for the complete object representing a registration
*
* @param $node_ids - a list of node IDs to query for
* @return list of objects
*/
function booking_load_query_old($node_ids = NULL, $fetchAssoc = FALSE)
{
//$studygroup_count = variable_get('booking_studygroup_count','0');
$studygroups = array();