function theme__quotes_blocks in Quotes 5
Renders the quote block list, including the "Add block" row.
@result The formatted HTML table of blocks.
Parameters
$form: The array specifying the form to be rendered.
File
- ./
quotes.module, line 1886
Code
function theme__quotes_blocks($form) {
$header = array(
t('Name'),
t('Filters'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
);
$result = db_query('SELECT qb.* FROM {quotes_blocks} qb ORDER BY qb.name');
$rows = array();
while ($block = db_fetch_object($result)) {
$filters = array();
if ($block->nid_filter) {
$filters[] = t('node');
}
if ($block->rid_filter) {
$filters[] = t('role');
}
if ($block->uid_filter) {
$filters[] = t('user');
}
if ($block->tid_filter) {
$filters[] = t('term');
}
$rows[] = array(
$block->name,
implode(', ', count($filters) ? $filters : array(
t('none'),
)),
l(t('configure block'), "admin/build/block/configure/quotes/{$block->bid}"),
l(t('delete block'), "admin/settings/quotes/delete/{$block->bid}"),
);
}
$rows[] = array(
drupal_render($form['name']),
array(
'data' => drupal_render($form['submit']),
'colspan' => 3,
),
);
$output = drupal_render($form);
if (count($rows)) {
$output .= theme('table', $header, $rows);
}
else {
$output .= theme('table', $header, array(
array(
array(
'data' => t('No blocks are defined.'),
'colspan' => 4,
),
),
));
}
return $output;
}