You are here

function panels_load_displays in Panels 6.3

Same name and namespace in other branches
  1. 8.3 panels.module \panels_load_displays()
  2. 5.2 panels.module \panels_load_displays()
  3. 6.2 panels.module \panels_load_displays()
  4. 7.3 panels.module \panels_load_displays()

Load and fill the requested $display object(s).

Helper function primarily for for panels_load_display().

@todo schema API can drasticly simplify this code.

Parameters

array $dids: An indexed array of dids to be loaded from the database.

Return value

$displays An array of displays, keyed by their display dids.

Related topics

2 calls to panels_load_displays()
panels_load_display in ./panels.module
Load a single display.
panels_mini_load_all in panels_mini/panels_mini.module
Load all mini panels.

File

./panels.module, line 761
panels.module

Code

function panels_load_displays($dids) {
  $displays = array();
  if (empty($dids) || !is_array($dids)) {
    return $displays;
  }
  $result = db_query("SELECT * FROM {panels_display} WHERE did IN (" . db_placeholders($dids) . ")", $dids);
  ctools_include('export');
  while ($obj = db_fetch_object($result)) {
    $displays[$obj->did] = ctools_export_unpack_object('panels_display', $obj);

    // Modify the hide_title field to go from a bool to an int if necessary.
  }
  $result = db_query("SELECT * FROM {panels_pane} WHERE did IN (" . db_placeholders($dids) . ") ORDER BY did, panel, position", $dids);
  while ($obj = db_fetch_object($result)) {
    $pane = ctools_export_unpack_object('panels_pane', $obj);
    $displays[$pane->did]->panels[$pane->panel][] = $pane->pid;
    $displays[$pane->did]->content[$pane->pid] = $pane;
  }
  return $displays;
}