function opigno_get_courses in Opigno 7
Returns an array of all course node NIDs for the platform.
Parameters
bool $only_published:
Return value
array
File
- ./
opigno.module, line 572 - Contains all hook_implementations and module specific API.
Code
function opigno_get_courses($only_published = FALSE) {
$query = db_select('node', 'n')
->fields('n', array(
'nid',
))
->condition('n.type', OPIGNO_COURSE_BUNDLE);
if ($only_published) {
$query
->condition('n.status', NODE_PUBLISHED);
}
$nids = array();
$result = $query
->execute();
while ($nid = $result
->fetchField()) {
$nids[] = $nid;
}
return $nids;
}