| 1 |
<?php
|
| 2 |
// $Id: scaffolding_example.pages.inc,v 1.4 2008/06/03 05:39:12 eaton Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Builds the module's user-facing pages.
|
| 7 |
*
|
| 8 |
* Contains a simple page callback and themable function for rendering a single
|
| 9 |
* record.
|
| 10 |
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Build a simple listing page for records.
|
| 14 |
*/
|
| 15 |
function scaffolding_example_page() {
|
| 16 |
$output = '';
|
| 17 |
|
| 18 |
if ($records = scaffolding_example_record_load_all()) {
|
| 19 |
foreach ($records as $record) {
|
| 20 |
$output .= theme('scaffolding_example_record', $record);
|
| 21 |
}
|
| 22 |
}
|
| 23 |
else {
|
| 24 |
drupal_set_message(t('No records have been added.'));
|
| 25 |
}
|
| 26 |
|
| 27 |
return $output;
|
| 28 |
}
|
| 29 |
|
| 30 |
/**
|
| 31 |
* Theme a single record.
|
| 32 |
*
|
| 33 |
* @ingroup themeable
|
| 34 |
*/
|
| 35 |
function theme_scaffolding_example_record($record) {
|
| 36 |
$output = '<div class="scaffolding-example-record" id="scaffolding-example-record-' . check_plain($record['record_id']) . '">';
|
| 37 |
$output .= '<h3 class="title">' . check_plain($record['title']) . '</h3>';
|
| 38 |
$output .= '<p>' . check_markup($record['content']) . '</p>';
|
| 39 |
$output .= '</div>';
|
| 40 |
|
| 41 |
return $output;
|
| 42 |
}
|