function support_pm_nodeapi in Support Ticketing System 6
Implementation of hook_nodeapi().
File
- support_pm/
support_pm.module, line 185 - Support Project Management. @author Jeremy Andrews <jeremy@tag1consulting.com> @package Support
Code
function support_pm_nodeapi(&$node, $op, $teaser, $page) {
if ($node->type == 'support_ticket') {
switch ($op) {
case 'view':
if (user_access('view support projects')) {
if ($project = support_pm_project_load_nid($node->nid)) {
$node->content['support-project'] = array(
'#value' => "<div class='support-priority'>Project: " . check_plain($project->project) . '</div>',
'#weight' => -1,
);
}
}
break;
case 'load':
$node->project = support_pm_project_load_nid($node->nid);
break;
case 'insert':
case 'update':
db_query("UPDATE {support_project_ticket} SET projid = %d WHERE nid = %d", $node->project, $node->nid);
if (!db_affected_rows()) {
@db_query("INSERT INTO {support_project_ticket} (projid, nid) VALUES(%d, %d)", $node->project, $node->nid);
}
break;
case 'delete':
db_query("DELETE FROM {support_project_ticket} WHERE nid = %d", $node->nid);
break;
}
}
}