Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (50 sloc) 1.26 KB
<?php
/**
* @file
* Administration page for bandcamp module
*/
/**
* Form builder for configuring Bandcamp settings
*
* @ingroup forms
* @see system_settings_form()
*/
function bandcamp_admin_settings() {
$form['bandcamp_api_key'] = array(
'#type' => 'textfield',
'#title' => t('Bandcamp API key'),
'#description' => t('Enter your bandcamp API key'),
'#default_value' => variable_get('bandcamp_api_key', ''),
);
return system_settings_form($form);
}
/**
* Callback for displaying simple table list of bands
*
* todo: At some point paginate this page
*/
function band_bands_view() {
$result = db_query("
SELECT bid FROM {bandcamp_band}
ORDER BY band_name
");
$bids = array();
foreach($result as $band) {
$bids[] = $band->bid;
}
$bands = band_load_multiple($bids, array());
$output = '';
if(!$bands) {
return t('There are currently no bands in the system');
}
$header = array(t('Band name'), '', '');
$rows = array();
foreach($bands as $band) {
$rows[] = array(
l($band->band_name, 'band/' . $band->bid),
l('Reimport', 'band/' . $band->bid . '/reimport'),
l('Delete', 'band/' . $band->bid . '/delete'),
);
}
return theme('table', array('header' => $header, 'rows' => $rows));
}