You are here

function panels_page_load_all in Panels 6.2

Same name and namespace in other branches
  1. 5.2 panels_page/panels_page.module \panels_page_load_all()

Fetch all panel pages in the system.

For the moment, this function does not cache. It may be integrated into the panels_page_loaded_cache() caching mechanism at some point, but its utility in D6 is significantly less vs. D5, so the need is less compelling.

4 calls to panels_page_load_all()
panels_page_list_page in panels_page/panels_page.admin.inc
Provide a list of panels, with links to edit or delete them.
panels_page_panels_exportables in panels_page/panels_page.module
Implementation of hook_panels_exportables().
_panels_page_check_switchers in panels_page/panels_page.render.inc
_panels_page_create_menu_structure in panels_page/panels_page.menu.inc

File

panels_page/panels_page.read.inc, line 16
panels_page.write.inc

Code

function panels_page_load_all($names = array(), $page_size = 0) {
  $pages = $dids = array();
  $query = "SELECT * FROM {panels_page}";
  if (!empty($names)) {
    $query .= " WHERE name IN (" . implode(', ', array_fill(0, count($names), "'%s'")) . ")";
  }
  if ($page_size) {
    $result = pager_query($query, $page_size, 0, $names);
  }
  else {
    $result = db_query($query, $names);
  }
  while ($page = db_fetch_object($result)) {
    $page->access = $page->access ? explode(', ', $page->access) : array();
    $page->arguments = !empty($page->arguments) ? unserialize($page->arguments) : array();
    $page->displays = !empty($page->displays) ? unserialize($page->displays) : array();
    $page->contexts = !empty($page->contexts) ? unserialize($page->contexts) : array();
    $page->relationships = !empty($page->relationships) ? unserialize($page->relationships) : array();
    $page->switcher_options = !empty($page->switcher_options) ? unserialize($page->switcher_options) : array();
    $page->type = t('Local');
    $page->load_flags = (int) $page->load_flags;
    $pages[$page->name] = panels_page_sanitize($page);
  }
  $status = variable_get('panel_page_defaults', array());
  foreach (panels_page_default_panels() as $page) {

    // Determine if default panel is enabled or disabled.
    if (isset($status[$page->name])) {
      $page->disabled = $status[$page->name];
    }
    if (!empty($pages[$page->name])) {
      $pages[$page->name]->type = t('Overridden');
    }
    else {
      $page->type = t('Default');

      // move the 'display' to the new 'primary' location.
      $page->primary = $page->display;
      unset($page->display);
      $pages[$page->name] = $page;
    }
  }
  return $pages;
}