You are here

function total_control_panel_pages_content_type_render in Total Control Admin Dashboard 6.2

Same name and namespace in other branches
  1. 7.2 plugins/content_types/panel_pages.inc \total_control_panel_pages_content_type_render()

Run-time rendering of the body of the block.

Parameters

$subtype:

$conf: Configuration as done at admin time.

$args:

$context: Context - in this case we don't have any.

Return value

An object with at least title and content members.

1 string reference to 'total_control_panel_pages_content_type_render'
panel_pages.inc in plugins/content_types/panel_pages.inc
panel_pages.inc

File

plugins/content_types/panel_pages.inc, line 71
panel_pages.inc

Code

function total_control_panel_pages_content_type_render($subtype, $conf, $args, $context) {
  $items = array();

  // Get panels pages.
  module_load_include('inc', 'page_manager', 'page_manager.admin');
  $tasks = page_manager_get_tasks_by_type('page');
  $pages = array(
    'operations' => array(),
  );
  page_manager_get_pages($tasks, $pages);
  $count = 0;

  // TODO
  $header = array(
    t('Page'),
    t('Operations'),
  );
  $rows = array();
  foreach ($pages['rows'] as $id => $info) {

    // TODO: config setting?
    // Only show enabled panels on the pane.
    if (array_key_exists('data', $info['data']['operations']) && stristr((string) $info['data']['operations']['data'], 'Enable') == FALSE) {
      $rows[] = array(
        'data' => array(
          $info['data']['title'],
          $info['data']['operations'],
        ),
        'class' => $info['class'],
      );

      // Only show 10.
      if (++$count >= 10) {
        break;
      }
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('You have no panel pages yet.'),
        'colspan' => 3,
      ),
    );
  }

  // Build a link to the page manager UI.
  if (user_access('use page manager')) {
    $link = l(t('Page manager administration'), 'admin/build/pages');
  }
  $block = new stdClass();
  $block->module = t('total_control');
  $block->title = t('Administer Panel pages');
  $block->content = theme('total_control_admin_table', $header, $rows, $link);
  return $block;
}