$_tmp = array(
'title' => 'download audio button',
'icon' => 'download',
'active' => 'on',
'group' => 'user'
);
jrCore_register_module_feature('jrCore', 'item_list_button', 'jrAudio', 'jrAudio_item_download_button', $_tmp);
/**
* Return "download" button for the audio item
* @param $module string Module name
* @param $_item array Item Array
* @param $_args Smarty function parameters
* @param $smarty Smarty Object
* @param $test_only - check if button WOULD be shown for given module
* @return string
*/
function jrAudio_item_download_button($module, $_item, $_args, $smarty, $test_only = false)
{
global $_conf;
if ($module == 'jrAudio') {
if ($test_only) {
return true;
}
if (jrCore_checktype($_item['audio_file_size'], 'number_nz')) {
// We have a valid audio file - check for allowed downloads
if ((isset($_conf['jrAudio_block_download']) && $_conf['jrAudio_block_download'] == 'off') || jrUser_is_admin()) {
$url = jrCore_get_module_url('jrAudio');
$_rt = array(
'url' => "{$_conf['jrCore_base_url']}/{$url}/download/audio_file/{$_item['_item_id']}/". urlencode(strtolower($_item['audio_file_original_name'])),
'icon' => 'download'
);
return $_rt;
}
}
}
return false;
}