function quotes_user_form in Quotes 6
Same name and namespace in other branches
- 5 quotes.user.inc \quotes_user_form()
- 7 quotes.user.inc \quotes_user_form()
1 string reference to 'quotes_user_form'
- quotes_user_page in ./
quotes.user.inc - @file Displays a Drupal page containing quotes submitted by a given user.
File
- ./
quotes.user.inc, line 24 - Displays a Drupal page containing quotes submitted by a given user.
Code
function quotes_user_form($form_state, $account) {
global $user;
$destination = drupal_get_destination();
$options = array();
$now = $_SERVER['REQUEST_TIME'];
$limit = variable_get('quotes_per_page', 10);
$node_ops = module_invoke_all('node_operations');
$query = db_rewrite_sql("SELECT n.* FROM {node} n WHERE n.uid=%d AND n.type='quotes' ORDER BY n.changed DESC");
$result = pager_query($query, $limit, 0, NULL, $account->uid);
while ($node = db_fetch_object($result)) {
$status = array();
$status[] = $node->status ? t('published') : t('not published');
if ($node->promoted) {
$status[] = t('promoted');
}
if ($node->sticky > 0) {
// >0 allows for sticky-encoded weighting.
$status[] = t('sticky');
}
if ($node->moderated) {
$status[] = t('moderated');
}
$form['title'][$node->nid] = array(
'#value' => l($node->title, 'node/' . $node->nid) . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
);
$form['status'][$node->nid] = array(
'#value' => implode(', ', $status),
);
$form['updated'][$node->nid] = array(
'#value' => format_interval($now - $node->changed),
);
$tid_list = array();
$terms = db_query("SELECT tn.tid, td.name FROM {term_node} tn LEFT JOIN {term_data} td USING (tid) WHERE tn.nid=%d AND tn.vid=%d", $node->nid, $node->vid);
while ($row = db_fetch_array($terms)) {
$tid_list[] = check_plain($row['name']);
}
$form['group'][$node->nid] = array(
'#value' => implode(', ', $tid_list),
);
if (_quotes_user_access_check($user, $account)) {
$form['operationse'][$node->nid] = array(
'#value' => l(t('edit'), 'node/' . $node->nid . '/edit', array(
'query' => $destination,
)),
);
$form['operationsd'][$node->nid] = array(
'#value' => l(t('delete'), 'node/' . $node->nid . '/delete', array(
'query' => $destination,
)),
);
}
}
$form['pager'] = array(
'#value' => theme('pager', NULL, $limit, 0),
);
return $form;
}