[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/ctools/ctools_access_ruleset/ -> ctools_access_ruleset.module (source)

   1  <?php
   2  // $Id: ctools_access_ruleset.module,v 1.1.2.3 2010/07/26 22:09:19 merlinofchaos Exp $
   3  
   4  /**
   5   * @file
   6   * ctools_access_ruleset module
   7   *
   8   * This module allows styles to be created and managed on behalf of modules
   9   * that implement styles.
  10   *
  11   * The ctools_access_ruleset tool allows recolorable styles to be created via a miniature
  12   * scripting language. Panels utilizes this to allow administrators to add
  13   * styles directly to any panel display.
  14   */
  15  
  16  /**
  17   * Implementation of hook_perm()
  18   */
  19  function ctools_access_ruleset_perm() {
  20    return array(
  21      'administer ctools access ruleset',
  22    );
  23  }
  24  
  25  /**
  26   * Implementation of hook_ctools_plugin_directory() to let the system know
  27   * we implement task and task_handler plugins.
  28   */
  29  function ctools_access_ruleset_ctools_plugin_directory($module, $plugin) {
  30    // Most of this module is implemented as an export ui plugin, and the
  31    // rest is in ctools/includes/ctools_access_ruleset.inc
  32    if ($module == 'ctools' && ($plugin == 'export_ui' || $plugin == 'access')) {
  33      return 'plugins/' . $plugin;
  34    }
  35  }
  36  
  37  /**
  38   * Implementation of hook_panels_dashboard_blocks().
  39   *
  40   * Adds page information to the Panels dashboard.
  41   */
  42  function ctools_access_ruleset_panels_dashboard_blocks(&$vars) {
  43    $vars['links']['ctools_access_ruleset'] = array(
  44      'title' => l(t('Custom ruleset'), 'admin/build/ctools-rulesets/add'),
  45      'description' => t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'),
  46    );
  47  
  48     // Load all mini panels and their displays.
  49    ctools_include('export');
  50    $items = ctools_export_crud_load_all('ctools_access_ruleset');
  51    $count = 0;
  52    $rows = array();
  53  
  54    foreach ($items as $item) {
  55      $rows[] = array(
  56        check_plain($item->admin_title),
  57        array(
  58          'data' => l(t('Edit'), "admin/build/ctools-rulesets/list/$item->name/edit"),
  59          'class' => 'links',
  60        ),
  61      );
  62  
  63      // Only show 10.
  64      if (++$count >= 10) {
  65        break;
  66      }
  67    }
  68  
  69    if ($rows) {
  70      $content = theme('table', array(), $rows, array('class' => 'panels-manage'));
  71    }
  72    else {
  73      $content = '<p>' . t('There are no custom rulesets.') . '</p>';
  74    }
  75  
  76    $vars['blocks']['ctools_access_ruleset'] = array(
  77      'title' => t('Manage custom rulesets'),
  78      'link' => l(t('Go to list'), 'admin/build/ctools-rulesets'),
  79      'content' => $content,
  80      'class' => 'dashboard-ruleset',
  81      'section' => 'right',
  82    );
  83  }


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7