function imagepicker_admin_groups in Image Picker 6.2
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_admin_groups()
- 7 imagepicker.admin.inc \imagepicker_admin_groups()
1 string reference to 'imagepicker_admin_groups'
- imagepicker_menu in ./
imagepicker.module - Implementation of hook_menu().
File
- ./
imagepicker.admin.inc, line 1771 - admin settings functions
Code
function imagepicker_admin_groups() {
drupal_add_css(IMAGEPICKER_PATH . '/imagepicker.css');
drupal_add_js(IMAGEPICKER_PATH . '/imagepicker.js');
module_load_include('inc', 'imagepicker', 'imagepicker.group');
if (!arg(4)) {
variable_del('imagepicker_currentuser');
variable_set('imagepicker_currentgroup', 0);
$action = 'users';
}
$uid = variable_get('imagepicker_currentuser', '');
if (arg(4) == 'user' && is_numeric(arg(5))) {
$uid = arg(5);
}
elseif (arg(4) == 'stats' || arg(4) == 'users') {
$action = arg(4);
}
$gidaction = '';
$gid = 0;
if ((arg(6) == 'browse' || arg(6) == 'edit' || arg(6) == 'delete') && is_numeric(arg(7))) {
$gidaction = arg(6);
$gid = arg(7);
if (arg(6) == 'browse') {
variable_set('imagepicker_currentgroup', $gid);
drupal_goto(IMAGEPICKER_ADMIN_PATH . '/images/user/' . $uid . '/browse');
}
}
$name = '';
$content = '';
if ($uid) {
$account = user_load(array(
'uid' => $uid,
));
$name = $account->name;
}
if (variable_get('imagepicker_groups_enabled', 1)) {
$content .= drupal_get_form('imagepicker_group_search_form');
$content .= '<p>' . t('Managing groups for ') . ($name ? l($name, "user/{$uid}") : 'All') . '</p>';
if ($uid) {
// show groups for $uid
if ($gid) {
if ($gidaction == 'edit') {
$record = imagepicker_get_user_group($gid);
$content .= drupal_get_form('imagepicker_groups_form', $record);
}
elseif ($gidaction == 'delete') {
$content .= drupal_get_form('imagepicker_group_delete_form', $gid);
}
}
elseif (arg(6) == 'stats') {
$content .= imagepicker_group_stats($account, t('Statistics for %name', array(
'%name' => $name,
)));
}
else {
$content .= imagepicker_groups_list('admin', $account, t('Groups for %name', array(
'%name' => $name,
)));
$content .= drupal_get_form('imagepicker_groups_form', 0, $account);
}
}
else {
if ($action == 'stats') {
$content .= imagepicker_group_stats(FALSE, t('Statistics'));
}
else {
$content .= imagepicker_admin_groups_list(t('Groups'));
}
}
}
return $content;
}