function flag_lists_get_flags in Flag Lists 6
Same name and namespace in other branches
- 7.3 flag_lists.module \flag_lists_get_flags()
- 7 flag_lists.module \flag_lists_get_flags()
Build array of all flag lists.
Return value
If limit and header arguments are provided, the paged flags, otherwise an array of all flags.
3 calls to flag_lists_get_flags()
- flag_lists_generate_lists_form_submit in ./
flag_lists.admin.inc - Submit handler for flag_lists_generate_lists_form.
- flag_lists_rebuild in ./
flag_lists.module - Update ALL flag lists with settings form values.
- theme_flag_lists_admin_page in ./
flag_lists.admin.inc - Theme the output for the main flag administration page.
File
- ./
flag_lists.module, line 700 - The Flag Lists module.
Code
function flag_lists_get_flags($limit = NULL, $header = NULL) {
$flags = array();
if ($limit) {
$sql = "SELECT fl.*, GROUP_CONCAT(ft.type) AS types FROM {flag_lists_flags} fl LEFT JOIN {flag_types} ft on ft.fid = fl.pfid GROUP BY fl.fid " . tablesort_sql($header) . "";
$count_sql = "SELECT COUNT(fid) FROM {flag_lists_flags}";
$result = pager_query($sql, $limit, 0, $count_sql);
}
else {
$result = db_query("SELECT fl.*, GROUP_CONCAT(ft.type) AS types FROM {flag_lists_flags} fl LEFT JOIN {flag_types} ft on ft.fid = fl.pfid GROUP BY fl.fid");
}
while ($row = db_fetch_object($result)) {
$flags[$row->name] = flag_flag::factory_by_row($row);
$flags[$row->name]->types = explode(',', $row->types);
$flags[$row->name]->uid = $row->uid;
}
return $flags;
}