You are here

function nodequeue_content_type_render in Total Control Admin Dashboard 6.2

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 'nodequeue_content_type_render'
nodequeue.inc in plugins/content_types/nodequeue.inc
nodequeue.inc

File

plugins/content_types/nodequeue.inc, line 64
nodequeue.inc

Code

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

  //Check for NodeQueue module.
  if (module_exists('nodequeue')) {

    // Get nodequeues.
    module_load_include('module', 'nodequeue', 'nodequeue');
    $queues = nodequeue_load_queues(nodequeue_get_all_qids(25));
    foreach ($queues as $queue) {
      if (!nodequeue_queue_access($queue)) {
        unset($queues[$queue->qid]);
      }
    }
    $options = array(
      'query' => array(
        'destination' => 'admin/dashboard',
      ),
    );
    $header = array(
      array(
        'data' => t('Title'),
        'field' => 'title',
        'sort' => 'asc',
      ),
      array(
        'data' => t('Max'),
        'field' => 'size',
      ),
      array(
        'data' => t('Operations'),
      ),
    );
    $rows = array();
    foreach ($queues as $queue) {
      $operations = array(
        l(t('Edit'), "admin/content/nodequeue/{$queue->qid}/view", $options),
      );
      $rows[] = array(
        array(
          'class' => 'nodequeue-title',
          'data' => check_plain($queue->title),
        ),
        array(
          'class' => 'nodequeue-max-nodes',
          'data' => $queue->size == 0 ? t('Infinite') : $queue->size,
        ),
        array(
          'class' => 'nodequeue-operation',
          'data' => implode(' | ', $operations),
        ),
      );
    }
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('There are no nodequeues to display.'),
        'colspan' => 3,
      ),
    );
  }
  if (user_access('administer nodequeue')) {
    $link = l(t('Nodequeue administration'), 'admin/content/nodequeue');
  }
  $block = new stdClass();
  $block->module = t('total_control');
  $block->title = t('Administer NodeQueues');
  $block->content = theme('total_control_admin_table', $header, $rows, $link);
  return $block;
}