mysite_type_biblio_active($type)
contrib/biblio.inc, line 51
Implements mysite_type_hook_active().
function mysite_type_biblio_active($type) {
// there must be active and allowed bibliographies
$value = TRUE;
$message = '';
$br = '';
// some users must be allowed to creation bibliographies, otherwise, give a configuration message
$result = db_query("SELECT perm FROM {permission}");
$check = '';
while ($perms = db_fetch_object($result)) {
$check .= $perms->perm;
}
if (!stristr($check, 'create biblio')) {
$value = FALSE;
$message = l(t('There are no users with permission to create bibliographies.'), 'admin/user/access');
$br = '<br />';
}
$count = db_result(db_query("SELECT COUNT(nid) FROM {node} WHERE type = 'biblio'"));
if ($count < 1) {
$value = FALSE;
$message = $br . l(t('At least one bibliography must exist.'), 'node/add/biblio');
}
return array($type => $value, 'message' => $message);
}