function workbench_scheduler_load_node_schedule in Workbench Scheduler 7
Same name and namespace in other branches
- 7.2 workbench_scheduler.module \workbench_scheduler_load_node_schedule()
Retrieves schedule data for a given node revision.
Parameters
int $nid: Node id.
int $vid: Revision id.
Return value
mixed Return an array of scheduler data for the node, or boolean TRUE if there is no schedule for this node.
3 calls to workbench_scheduler_load_node_schedule()
- workbench_scheduler_admin_edit_revision_schedule in ./
workbench_scheduler.admin.inc - Form to edit the schedule for an existing node revision.
- workbench_scheduler_admin_manage_node_schedules in ./
workbench_scheduler.admin.inc - Tableselect form for current schedules applied to a node.
- workbench_scheduler_node_load in ./
workbench_scheduler.module - Implements hook_node_load().
File
- ./
workbench_scheduler.module, line 691 - Content scheduling for Workbench.
Code
function workbench_scheduler_load_node_schedule($nid, $vid) {
// Select from the workbench_scheduler_nodes table.
$node_schedule_query = db_select('workbench_scheduler_nodes', 'wsn');
// Join the workbench_scheduler_schedule table on the schedule id.
$node_schedule_query
->innerjoin('workbench_scheduler_schedules', 'wss', 'wsn.sid = wss.sid');
// Retrieve the node start and end date.
$node_schedule_query
->fields('wsn', array(
'start_date',
'end_date',
'completed',
))
->fields('wss');
// WHERE node id matches this node id.
$node_schedule_query
->condition('wsn.nid', $nid)
->condition('wsn.vid', $vid)
->range(0, 1);
$node_schedule = $node_schedule_query
->execute();
// Was data successfully retrieve?
if ($node_schedule
->rowCount()) {
return $node_schedule
->fetchObject();
}
// Return a boolean false if nothing is retrieved.
return FALSE;
}