function document_moderate_form in Document 7
Same name and namespace in other branches
- 6 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 138
Code
function document_moderate_form($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' => 'n.title',
'sort' => 'asc',
),
array(
'data' => t('Author'),
'field' => 'author',
),
array(
'data' => t('Year of Publication'),
'field' => 'publish_year',
),
'Keywords',
'',
);
$query = db_select('node', 'n');
$query
->join('document', 'd', 'n.vid = d.vid');
$query
->condition('n.status', DOCUMENT_STATUS_PUBLISHED, '<>')
->extend('PagerDefault')
->limit(10)
->extend('TableSort')
->orderByHeader($headers)
->fields('n')
->fields('d');
$results = $query
->execute();
$imgPublish = theme_image(array(
'path' => document_image_url('spacer.gif'),
'alt' => t('Publish'),
'title' => t('Publish'),
'attributes' => array(
'onclick' => 'doc.changeDocStatus(this, %1$d, \'icon-publish\', true);',
'class' => 'icon-publish',
'width' => 16,
'height' => 16,
),
));
$imgDelete = theme_image(array(
'path' => document_image_url('spacer.gif'),
'alt' => t('Delete'),
'title' => t('Delete'),
'attributes' => array(
'onclick' => 'doc.deleteDoc(this, %1$d, \'icon-delete\');',
'class' => 'icon-delete',
'width' => 16,
'height' => 16,
),
));
$rows = array();
foreach ($results as $doc) {
$row = 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',
),
)),
);
$rows[] = $row;
}
$table = theme('table', array(
'header' => $headers,
'rows' => $rows,
));
$form['document_moderate_table'] = array(
'#type' => 'markup',
'#markup' => $table,
);
return $form;
}