You are here

function skinr_ui_list in Skinr 7.2

Same name and namespace in other branches
  1. 6.2 skinr_ui.admin.inc \skinr_ui_list()

Menu callback: skin configurations administration.

1 string reference to 'skinr_ui_list'
skinr_ui_menu in ./skinr_ui.module
Implements hook_menu().

File

./skinr_ui.admin.inc, line 376
Admin page callbacks for the Skinr UI module.

Code

function skinr_ui_list($form, &$form_state) {
  if (isset($form_state['values']['operation']) && $form_state['values']['operation'] == 'delete') {
    return skinr_ui_multiple_delete_confirm($form, $form_state, array_filter($form_state['values']['skins']));
  }
  $form['filter'] = skinr_ui_filter_form('skinr_ui_filters', $form_state);
  $form['#submit'][] = 'skinr_ui_filter_form_submit';
  $header = array(
    'theme' => array(
      'data' => t('Theme'),
      'field' => 's.theme',
    ),
    'type' => array(
      'data' => t('Type'),
      'field' => 's.module',
    ),
    'element' => array(
      'data' => t('Element'),
      'field' => 's.element',
    ),
    'skin' => array(
      'data' => t('Skin'),
      'field' => 's.skin',
    ),
    'status' => array(
      'data' => t('Status'),
      'field' => 's.status',
      'sort' => 'desc',
    ),
    'storage' => array(
      'data' => t('Storage'),
    ),
    'operations' => array(
      'data' => t('Operations'),
    ),
  );
  $query = db_select('skinr_skins', 's')
    ->extend('PagerDefault')
    ->extend('TableSort');
  skinr_ui_build_filter_query($query);
  $query
    ->fields('s', array(
    'sid',
  ))
    ->limit(50)
    ->orderByHeader($header);
  if (empty($_GET['order'])) {

    // Default sort.
    $query
      ->orderBy('s.status', 'desc')
      ->orderBy('s.theme')
      ->orderBy('s.module')
      ->orderBy('s.element');
  }
  $sids = $query
    ->execute()
    ->fetchCol();
  $skins = skinr_skin_load_multiple($sids);
  $form['admin'] = skinr_ui_admin_skins($header, $skins);
  return $form;
}