function quotes_export in Quotes 6
Same name and namespace in other branches
- 5 quotes.module \quotes_export()
- 7 quotes.admin.inc \quotes_export()
Export function page.
Return value
A form with a tab-delimited list of quotes.
1 string reference to 'quotes_export'
- quotes_menu in ./
quotes.module - Implementation of hook_menu().
File
- ./
quotes.admin.inc, line 217 - The quotes module allows users to maintain a list of quotes that can be displayed in any number of administrator-defined quote blocks.
Code
function quotes_export() {
$form['intro'] = array(
'#type' => 'item',
'#title' => t('Copy and paste this list to the receiving site'),
);
$output = NULL;
$count = 0;
$sql = db_rewrite_sql("SELECT nr.body, nr.title, qa.name AS author, q.citation FROM {node} n INNER JOIN {node_revisions} nr USING (vid) INNER JOIN {quotes} q USING (vid) INNER JOIN {quotes_authors} qa USING (aid) WHERE n.status=1 AND n.type='quotes' ORDER BY qa.name");
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
++$count;
$output .= _quotes_escape_newlines($row->body) . "\t" . _quotes_escape_newlines($row->author) . "\t" . _quotes_escape_newlines($row->citation) . "\n";
}
drupal_set_message(t('Found @count quotes.', array(
'@count' => $count,
)));
if ($count == 0) {
$count = 1;
$output = t('No quotes were found.');
}
$form['list'] = array(
'#type' => 'textarea',
'#value' => $output,
'#rows' => min(30, $count),
);
return $form;
}