function imagepicker_groups_form in Image Picker 6.2
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_groups_form()
- 5 imagepicker.module \imagepicker_groups_form()
- 7 imagepicker.group.inc \imagepicker_groups_form()
4 string references to 'imagepicker_groups_form'
- imagepicker_admin_groups in ./
imagepicker.admin.inc - imagepicker_groups in ./
imagepicker.group.inc - @file contains the functions for group management
- imagepicker_group_edit in ./
imagepicker.group.inc - imagepicker_user_groups in ./
imagepicker.group.inc - groups from imagepicker groups in my account
File
- ./
imagepicker.group.inc, line 51 - contains the functions for group management
Code
function imagepicker_groups_form(&$form_state, $record = 0, $account = FALSE) {
$form['groupsave'] = array(
'#type' => 'fieldset',
'#title' => $record ? t('Edit group') : t('Add group'),
'#description' => t('Give your group a brief name and optionally put any additional information in the group description box'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['groupsave']['group_name'] = array(
'#type' => 'textfield',
'#title' => t('Group name'),
'#size' => 20,
'#default_value' => isset($record->group_name) ? $record->group_name : '',
'#required' => TRUE,
);
$form['groupsave']['group_description'] = array(
'#type' => 'textfield',
'#title' => t('group description'),
'#size' => 50,
'#maxlength' => 50,
'#default_value' => isset($record->group_description) ? $record->group_description : '',
'#description' => t('Maximum 50 characters'),
'#required' => FALSE,
);
if (user_access('use public imagepicker') && user_access('create public groups') && variable_get('imagepicker_public_enabled', 1)) {
$form['groupsave']['group_public'] = array(
'#type' => 'checkbox',
'#title' => t('Public'),
'#return_value' => 1,
'#default_value' => isset($record->public) ? $record->public : '',
'#description' => t('Make this group publicly available'),
);
// Create role restrictions
if (variable_get('imagepicker_publicroles_enabled', 1)) {
$form['groupsave']['group_public_roles'] = array(
'#type' => 'fieldset',
'#title' => isset($record->gid) ? t('Edit group roles') : t('Add public group roles'),
'#description' => t('Add roles for public access to your group. (Don\'t check anything to make it available to all roles.)'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
// Output a list of available roles as checkboxes
$form['groupsave']['group_public_roles']['roles']['#tree'] = TRUE;
if (isset($record->avail_roles)) {
if ($record->avail_roles != 'all') {
$availroles = explode(':', $record->avail_roles);
}
}
foreach (user_roles(TRUE) as $rid => $role) {
if (imagepicker_role_has_permission($rid)) {
if (isset($availroles) && is_array($availroles) && in_array($role, array_values($availroles))) {
$checked = TRUE;
}
else {
$checked = FALSE;
}
$form['groupsave']['group_public_roles']['roles'][$rid] = array(
'#type' => 'checkbox',
'#title' => $role,
'#return_value' => $role,
'#default_value' => $checked ? 1 : '',
);
}
}
}
}
else {
$form['groupsave']['group_public'] = array(
'#type' => 'value',
'#value' => 0,
);
}
if ($account) {
$form['groupsave']['account'] = array(
'#type' => 'value',
'#value' => $account->uid,
);
}
if (isset($record->gid)) {
$form['groupsave']['gid'] = array(
'#type' => 'value',
'#value' => $record->gid,
);
}
$form['groupsave']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save group'),
);
return $form;
}