function biblio_coins_generate in Bibliography Module 7
Same name and namespace in other branches
- 5 biblio.module \biblio_coins_generate()
- 6.2 includes/biblio.util.inc \biblio_coins_generate()
- 6 biblio.module \biblio_coins_generate()
- 7.2 includes/biblio.util.inc \biblio_coins_generate()
File
- includes/
biblio.util.inc, line 217
Code
function biblio_coins_generate(&$node) {
if (!isset($node->vid)) {
$node->biblio_coins = biblio_coins($node);
return;
}
if ($node) {
$node->biblio_coins = biblio_coins($node);
db_update('biblio')
->fields(array(
'biblio_coins' => $node->biblio_coins,
))
->condition('vid', $node->vid)
->execute();
}
else {
$result = db_query("SELECT nr.*, b.*\n FROM {node} AS n\n LEFT JOIN {node_revision} AS nr ON n.vid = nr.vid LEFT JOIN {biblio} AS b ON n.vid = b.vid\n WHERE n.type = 'biblio' ");
foreach ($result as $node) {
$node->biblio_coins = biblio_coins($node);
db_update('biblio')
->fields(array(
'biblio_coins' => $node->biblio_coins,
))
->condition('vid', $node->vid)
->execute();
}
drupal_goto('');
}
}