function tripal_pub_nodeapi
1.x tripal_pub.module | tripal_pub_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) |
File
- tripal_pub/
tripal_pub.module, line 907 - The Tripal Publication module allows you to search the PubMed databse for academic articles, that relate to user specified tpoic\s. As well, it allows management of publications so that a user can enter specified details regarding a desired…
Code
function tripal_pub_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
// we want the publications to always have a URL of http://[base url]/pub/[pub id]
// where [pub id] is the Chado publication ID. This will allow for easy linking
// into the publication without needing to know the node. Of course if you know the
// node that will still work too (e.g. http://[base url]/node/[node id]
// so the nodeapi function ensures that the URL path is set after insert or update
// of the node and when the node is loaded if it hasn't yet been set.
if ($node->type == 'chado_pub') {
switch ($op) {
case 'presave':
break;
case 'insert':
$pub_id = chado_get_id_for_node('pub', $node);
tripal_pub_set_pub_url($node, $pub_id);
break;
case 'load':
if (!$node->path) {
$pub_id = chado_get_id_for_node('pub', $node);
$path = tripal_pub_set_pub_url($node, $pub_id);
}
break;
case 'update':
$pub_id = chado_get_id_for_node('pub', $node);
tripal_pub_set_pub_url($node, $pub_id);
break;
case 'view':
break;
}
}
}