You are here

function total_control_overview_content_type_render in Total Control Admin Dashboard 7.2

Same name and namespace in other branches
  1. 6.2 plugins/content_types/overview.inc \total_control_overview_content_type_render()
  2. 6 plugins/content_types/overview.inc \total_control_overview_content_type_render()

Run-time rendering of the body of the block.

File

plugins/content_types/overview.inc, line 41

Code

function total_control_overview_content_type_render($subtype, $conf, $panel_args, &$context) {

  // Content Overview.
  $overview_cnt = total_control_get_content_overview($conf);

  // User Overview.
  $overview_usr = array();
  $user_data = total_control_get_user_overview($conf);
  $users_all = format_plural($user_data['all'], '1 total user', '@count total users');
  $users_active = format_plural($user_data['active'], '1 active', '@count active');
  $users_blocked = format_plural($user_data['blocked'], '1 blocked', '@count blocked');
  $overview_usr[] = $users_all . ' | ' . $users_active . ' | ' . $users_blocked;

  // Roles Overview.
  foreach ($user_data['roles'] as $rid => $data) {
    $overview_usr['role_' . $rid] = format_plural($user_data['roles'][$rid]['count'], '1 user account', '@count user accounts');
    $overview_usr['role_' . $rid] .= ' with the role: ' . $user_data['roles'][$rid]['name'];
  }
  $block = new stdClass();
  $block->module = t('total_control');
  $block->title = t('Content and User overview');
  $block->content = theme('total_control_overview', array(
    'content' => $overview_cnt,
    'users' => $overview_usr,
  ));
  return $block;
}