function skinr_ui_admin_skins in Skinr 6.2
Same name and namespace in other branches
- 7.2 skinr_ui.admin.inc \skinr_ui_admin_skins()
Form builder: Builds the skinr administration overview.
1 call to skinr_ui_admin_skins()
- skinr_ui_list in ./
skinr_ui.admin.inc - Menu callback; displays the skinr listing page.
File
- ./
skinr_ui.admin.inc, line 26 - Admin page callbacks for the skinr module.
Code
function skinr_ui_admin_skins() {
$session = !empty($_SESSION['skinr_ui_overview_filter']) && is_array($_SESSION['skinr_ui_overview_filter']) ? $_SESSION['skinr_ui_overview_filter'] : array();
$filters = array();
foreach ($session as $filter) {
list($key, $value) = $filter;
$filters[$key] = $value;
}
$sorts = array();
$form['options'] = array(
'#type' => 'fieldset',
'#title' => t('Update options'),
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
$options = array();
foreach (module_invoke_all('skinr_operations') as $operation => $array) {
$options[$operation] = $array['label'];
}
$form['options']['operation'] = array(
'#type' => 'select',
'#options' => $options,
'#default_value' => 'approve',
);
$form['options']['submit'] = array(
'#type' => 'submit',
'#value' => t('Update'),
'#submit' => array(
'skinr_ui_admin_skins_submit',
),
);
$themes = list_themes();
ksort($themes);
$skinr_settings = array();
$options = array();
$destination = drupal_get_destination();
$type = !empty($filters['type']) ? $filters['type'] : NULL;
foreach ($themes as $theme) {
if (!$theme->status || !empty($filters['theme']) && $filters['theme'] != $theme->name) {
continue;
}
if (empty($type)) {
$skinrs = skinr_get($theme->name);
}
else {
$skinrs = array(
$type => skinr_get($theme->name, $type),
);
}
foreach ($skinrs as $module => $elements) {
foreach ($elements as $sid => $skin) {
$key = $theme->name . '__' . $module . '__' . $sid;
$skinr_settings[$key] = '';
if ($module == 'page') {
$url_edit = 'admin/build/skinr/rules/edit/' . $sid;
}
else {
$url_edit = 'admin/build/skinr/edit/nojs/' . $module . '/' . $sid;
}
$url_delete = 'admin/build/skinr/delete/' . $theme->name . '/' . $module . '/' . $sid;
$operations = array(
'edit' => array(
'title' => t('edit'),
'href' => $url_edit,
'query' => $destination,
),
'delete' => array(
'title' => t('delete'),
'href' => $url_delete,
'query' => $destination,
),
);
$options[$key] = array(
'theme' => $theme->info['name'],
'type' => $module,
'sid' => $sid,
'operations' => theme('links', $operations, array(
'class' => 'links inline',
)),
);
}
}
}
$form['rows'] = array(
'#type' => 'value',
'#value' => $options,
);
$form['skinr_settings'] = array(
'#type' => 'checkboxes',
'#options' => $skinr_settings,
);
$form['#theme'] = 'skinr_ui_admin_skins';
return $form;
}