You are here

function delta_get_layouts in Delta 7.2

delta_get_layouts function.

@access public

@todo Make the SQL SELECT statement conform to the PDO

Parameters

mixed $theme. (default: FALSE):

Return value

void

1 call to delta_get_layouts()
delta_layouts_list in ./delta_ui.admin.inc
Menu callback; displays the delta listing page.

File

./delta_ui.admin.inc, line 87
Delta UI functionality

Code

function delta_get_layouts($theme = FALSE) {
  if (isset($theme)) {
    $header = array(
      t('Name'),
      array(
        'data' => t('Operations'),
        'colspan' => '3',
      ),
    );
    $rows = array();
    $sql = "\n\t    SELECT dt.name, dt.system_name, dt.tid \n\t    FROM {delta_theme_settings} dt\n\t    WHERE dt.theme = :theme\n\t    ORDER BY dt.name ASC";
    $result = db_query($sql, array(
      ':theme' => $theme,
    ), array(
      'fetch' => PDO::FETCH_ASSOC,
    ));
    foreach ($result as $item) {
      $row = array(
        'name' => '<h3>' . $item['name'] . '</h3><span class="description"><strong>' . t('Machine Name: ') . '</strong><em>' . $item['system_name'] . '</em></span>',
        'edit' => l(t('Edit'), 'admin/appearance/delta/layouts/edit/' . $item['system_name']),
        'configure' => l(t('Configure'), 'admin/appearance/delta/layouts/configure/' . $item['system_name']),
        'delete' => l(t('Delete'), 'admin/appearance/delta/layouts/delete/' . $item['system_name']),
      );
      $rows[] = $row;
    }
    $build['table'] = array(
      '#theme' => 'table',
      '#header' => $header,
      '#rows' => $rows,
      '#empty' => t('No theme settings templates available. <a href="@link">Add layout</a>.', array(
        '@link' => url('admin/appearance/delta/layouts/add'),
      )),
    );
    return $build;
  }
  return FALSE;
}