You are here

function uc_store_admin in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_store/uc_store.admin.inc \uc_store_admin()
  2. 7.3 uc_store/uc_store.admin.inc \uc_store_admin()
1 string reference to 'uc_store_admin'
uc_store_menu in uc_store/uc_store.module
Implementation of hook_menu().

File

uc_store/uc_store.module, line 522
Contains global Ubercart functions and store administration functionality.

Code

function uc_store_admin() {
  $main_menu = menu_get_item(NULL, 'admin/store');
  usort($main_menu['children'], '_menu_sort');
  if (($type = variable_get('uc_store_admin_page_display', 1)) == 4) {
    $main_menu = menu_get_item(NULL, 'admin/store');
    $content = system_admin_menu_block($main_menu);
    $output = theme('admin_block_content', $content);
  }
  else {
    foreach ($main_menu['children'] as $mid) {
      if ($mid > 0) {
        $menus[] = menu_get_item($mid);
      }
    }
    $output = theme('uc_admin_dashboard', $type, $menus);
  }
  $results = module_invoke_all('store_status');
  foreach ($results as $message) {
    switch ($message['status']) {
      case 'warning':
        $icon = base_path() . drupal_get_path('module', 'uc_store') . '/images/alert.gif';
        break;
      case 'error':
        $icon = base_path() . drupal_get_path('module', 'uc_store') . '/images/error.gif';
        break;
      case 'ok':
      default:
        $icon = base_path() . drupal_get_path('module', 'uc_store') . '/images/info.gif';
    }
    $rows[] = array(
      'data' => array(
        array(
          'data' => '<img src="' . $icon . '" />',
        ),
        array(
          'data' => '<strong>' . $message['title'] . '</strong>',
          'nowrap' => 'nowrap',
        ),
        array(
          'data' => $message['desc'],
          'width' => '100%',
        ),
      ),
      'valign' => 'top',
    );
  }
  $header = array(
    '&nbsp;',
    t('Title'),
    t('Description'),
  );
  $output .= '<div style="clear: both;"><h2>' . t('Status messages:') . '</h2>' . theme('table', $header, $rows) . '</div>';
  return $output;
}