function event_get_types in Event 5
Same name and namespace in other branches
- 5.2 event.module \event_get_types()
Get an array of nodes with a given state. If no state is provided an array with all nodes keyed by state will be returned. The possible states are: 'all' Always shown in the calendar. 'solo' Only shown with nodes of its type. 'never' Never show in the calendar.
Parameters
$state string state name:
Return value
array of node types
13 calls to event_get_types()
- event_calendar_data in ./
event.module - Returns an array of nodes that occur on a given date. Handles content type and taxonomy filters.
- event_enabled_state in ./
event.module - Find the state of a node type. The state determines if and how those nodes will be displayed in the calendar. The state values are: 'all' Always shown in the calendar. 'solo' Only shown with nodes of its type. 'never'…
- event_filter_node in ./
event.module - event_filter_nodes in ./
event.module - event_is_enabled in ./
event.module - Find out if a node type is shown in all calendars.
File
- ./
event.module, line 2089
Code
function event_get_types($state = NULL) {
static $types;
if (!is_array($types)) {
$types['all'] = array();
$types['solo'] = array();
$types['never'] = array();
$result = db_query("SELECT * FROM {variable} WHERE name like 'event_nodeapi_%'");
while ($type = db_fetch_object($result)) {
$types[unserialize($type->value)][] = substr($type->name, 14);
}
}
switch ($state) {
case 'all':
return $types['all'];
break;
case 'solo':
return $types['solo'];
break;
case 'never':
return $types['never'];
break;
default:
return $types;
break;
}
}