function protected_pages_get_pages_list in Protected Pages 7
Same name and namespace in other branches
- 7.2 protected_pages.admin.inc \protected_pages_get_pages_list()
Callback to generate list of protected pages.
2 calls to protected_pages_get_pages_list()
- protected_pages_configure in ./
protected_pages.admin.inc - Callback function for add protected page.
- protected_pages_configure_submit_callback in ./
protected_pages.admin.inc - Ajax submit callback for add protected page form.
File
- ./
protected_pages.admin.inc, line 54 - Provides page callbacks for configuration page.
Code
function protected_pages_get_pages_list() {
$header = array(
array(
'data' => t('#'),
'width' => '10%',
),
array(
'data' => t('Relative Path'),
'width' => '60%',
),
array(
'data' => t('Operations'),
'colspan' => 3,
'width' => '30%',
),
);
$rows = array();
$query = db_select('protected_pages', 'pp')
->extend('PagerDefault')
->extend('TableSort');
$query
->fields('pp')
->limit(20)
->orderByHeader($header);
$result = $query
->execute();
$rows = array();
$count = 1;
foreach ($result as $data) {
$rows[] = array(
'data' => array(
$count,
$data->path,
l(t('Edit'), "admin/config/system/protected_pages/" . $data->pid . "/edit"),
l(t('Delete'), 'admin/config/system/protected_pages/' . $data->pid . "/delete"),
l(t('Send E-mail'), 'admin/config/system/protected_pages/' . $data->pid . "/send_email"),
),
);
$count++;
}
$output = theme_table(array(
"header" => $header,
"rows" => $rows,
"attributes" => array(
'width' => "500",
),
"sticky" => TRUE,
"caption" => "",
"colgroups" => array(),
"empty" => t("No record found!"),
)) . theme("pager");
return $output;
}