function reviews_list in Reviews 7
Form builder for reviews moderation.
1 string reference to 'reviews_list'
- reviews_menu in ./
reviews.module - Implements hook_menu().
File
- includes/
reviews.admin.inc, line 187 - This file contains all the functions necessary for the admin pages of the reviews system.
Code
function reviews_list($form, &$form_state) {
$form = array();
// Check for confirmation forms.
if (isset($form_state['confirm_delete'])) {
return array_merge($form, reviews_list_confirm_delete($form, $form_state));
}
$result = db_select('reviews', 'r')
->extend('PagerDefault')
->limit(15)
->fields('r')
->orderBy('created', 'ASC')
->execute();
$header = array(
'rid' => array(
'data' => t('Review ID'),
),
'node_title' => array(
'data' => t('Reviewed Content Title'),
),
'username' => array(
'data' => t('Reviewer'),
),
'review' => array(
'data' => t('Review'),
),
'status' => array(
'data' => t('Status'),
),
'actions' => array(
'data' => t('Operations'),
),
);
$data = array();
while ($review = $result
->fetchAssoc()) {
$review_content = unserialize($review['review']);
$links['items'] = array(
l(t('view'), 'node/' . $review['nid'] . '/reviews', array(
'fragment' => 'review_' . $review['rid'],
)),
);
$data[$review['rid']] = array(
'rid' => $review['rid'],
'node_title' => check_plain(reviews_get_node_title($review['nid'])),
'username' => check_plain(reviews_get_username($review['uid'])),
'review' => check_markup($review_content['value'], $review_content['format']),
'status' => reviews_get_review_status($review['status']),
'actions' => theme('item_list', $links),
);
if (variable_get('reviews_use_rating')) {
$data[$review['rid']]['rating'] = $review['rating'];
}
}
$form['reviews'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $data,
'#empty' => t('There are currently no reviews.'),
);
$form['pager'] = array(
'#markup' => theme('pager', array(
'tags' => array(),
)),
);
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete'),
'#access' => user_access('administer reviews'),
'#weight' => 10,
);
return $form;
}