function imagepicker_admin_groups in Image Picker 7
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_admin_groups()
- 6.2 imagepicker.admin.inc \imagepicker_admin_groups()
1 string reference to 'imagepicker_admin_groups'
- imagepicker_menu in ./
imagepicker.module - Implement hook_menu().
File
- ./
imagepicker.admin.inc, line 1393 - @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Code
function imagepicker_admin_groups() {
drupal_add_css(IMAGEPICKER_PATH . '/imagepicker.css');
$imagepicker_jspaths = imagepicker_jspaths_get();
drupal_add_js($imagepicker_jspaths['imagepicker_jspath']);
module_load_include('inc', 'imagepicker', 'imagepicker.group');
$content = '';
$action = '';
$rows = NULL;
$gid = FALSE;
if (!arg(5)) {
imagepicker_variable_del('imagepicker_currentuser');
imagepicker_variable_set('imagepicker_currentgroup', 0);
$action = 'users';
}
$uid = imagepicker_variable_get('imagepicker_currentuser', '');
if (arg(5) == 'user' && is_numeric(arg(6))) {
$uid = arg(6);
}
elseif (arg(5) == 'stats' || arg(5) == 'users') {
$action = arg(5);
}
if ((arg(7) == 'browse' || arg(7) == 'edit' || arg(7) == 'delete') && is_numeric(arg(8))) {
$gidaction = arg(7);
$gid = arg(8);
if (arg(7) == 'browse') {
imagepicker_variable_set('imagepicker_currentgroup', $gid);
drupal_goto(IMAGEPICKER_ADMIN_PATH . '/images/user/' . $uid . '/browse');
}
}
$name = "";
if ($uid) {
$account = user_load($uid);
$name = $account->name;
}
if (imagepicker_variable_get('imagepicker_groups_enabled', 1)) {
$form = drupal_get_form('imagepicker_group_search_form', 'groups');
$content .= render($form);
$content .= '<p>' . t('Managing groups for !n', array(
'!n' => $name ? l($name, "user/{$uid}") : t('All'),
)) . '</p>';
if ($uid) {
// show groups for $uid
if ($gid) {
if ($gidaction == 'edit') {
$record = imagepicker_get_user_group($gid);
$form = drupal_get_form('imagepicker_groups_form', $record);
$content .= render($form);
}
elseif ($gidaction == 'delete') {
$form = drupal_get_form('imagepicker_group_delete_form', $gid);
$content .= render($form);
}
}
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,
)));
$form = drupal_get_form('imagepicker_groups_form', 0, $account);
$content .= render($form);
}
}
else {
if ($action == 'stats') {
$content .= imagepicker_group_stats(FALSE, t('Statistics'));
}
else {
$content .= imagepicker_admin_groups_list(t('Groups'));
}
}
}
return $content;
}