You are here

function imagepicker_get_groups in Image Picker 7

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_get_groups()
  2. 5 imagepicker.module \imagepicker_get_groups()
  3. 6.2 imagepicker.functions.inc \imagepicker_get_groups()
5 calls to imagepicker_get_groups()
imagepicker_browse_groups_form_submit in ./imagepicker.functions.inc
Submit browse groups form
imagepicker_group_images_form in ./imagepicker.functions.inc
Insert a form into the edit image page to allow the image to be associated with a group.
imagepicker_import_form in ./imagepicker.import.inc
Function to display the image import form.
imagepicker_multitask_groups_form in ./imagepicker.functions.inc
imagepicker_upload_form in ./imagepicker.upload.inc

File

./imagepicker.functions.inc, line 1347
@author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function imagepicker_get_groups($account = FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $query = db_select('imagepicker_user_groups', 'g');
  $query
    ->fields('g', array(
    'gid',
    'uid',
    'group_name',
    'group_description',
    'state',
    'public',
    'avail_roles',
  ));
  $query
    ->condition('g.uid', $user->uid);
  $rows = $query
    ->execute();
  $count = 0;
  foreach ($rows as $row) {
    $data[$row->gid] = $row->group_name . ($row->public ? ' - ' . t('Public') : ' - ' . t('Private'));
    $count++;
  }
  if ($count) {
    return $data;
  }
  return FALSE;
}