function document_moderate_form in Document 6
Same name and namespace in other branches
- 7 document.admin.inc \document_moderate_form()
- 8.x document.admin.inc \document_moderate_form()
1 string reference to 'document_moderate_form'
- document_menu in ./
document.module - Implementation of hook_menu().
File
- ./
document.admin.inc, line 124
Code
function document_moderate_form(&$form_state) {
drupal_add_css(drupal_get_path('module', 'document') . '/document.css');
drupal_add_js(drupal_get_path('module', 'document') . '/document.js');
_document_register_validation_token();
_document_register_status();
$headers = array(
'',
array(
'data' => t('Type'),
'field' => 'd.type',
),
array(
'data' => t('Title'),
'field' => 'title',
'sort' => 'asc',
),
array(
'data' => t('Author'),
'field' => 'author',
),
array(
'data' => t('Year of Publication'),
'field' => 'publish_year',
),
'Keywords',
'',
);
$sql = sprintf('SELECT * FROM {node} n INNER JOIN {document} d ON n.vid = d.vid WHERE n.status <> %d', DOCUMENT_STATUS_PUBLISHED);
//add the order by clause
$sql .= tablesort_sql($headers);
$results = pager_query($sql, 10);
$imgPublish = theme_image(document_image_url('spacer.gif'), t('Publish'), t('Publish'), array(
'onclick' => 'doc.changeDocStatus(this, %1$d, \'icon-publish\', true);',
'class' => 'icon-publish',
'width' => 16,
'height' => 16,
), FALSE);
$imgDelete = theme_image(document_image_url('spacer.gif'), t('Delete'), t('Delete'), array(
'onclick' => 'doc.deleteDoc(this, %1$d, \'icon-delete\');',
'class' => 'icon-delete',
'width' => 16,
'height' => 16,
), FALSE);
$rows = array();
while ($doc = db_fetch_object($results)) {
$rows[] = array(
sprintf($imgPublish . ' ' . $imgDelete, $doc->nid),
check_plain($doc->type),
l($doc->title, 'node/' . $doc->nid),
check_plain($doc->author),
$doc->publish_year,
check_plain($doc->keywords),
l('Download', $doc->url, array(
'attributes' => array(
'target' => '_blank',
),
)),
);
}
$table = theme('table', $headers, $rows);
$table .= theme('pager', array(), 10, 0);
$form = array();
$form['document_moderate_table'] = array(
'#type' => 'markup',
'#value' => $table,
);
return $form;
}