'textfield', '#title' => t('Suche'), '#size' => 30, '#maxlength' => 64, '#description' => t('Suchbegriff in Titel, Album oder Interpret'), '#prefix' => '

', ); if (!empty($form_state['storage']['values'])) { $form['result'] = array( '#value' => $form_state['storage']['results'] ); } return $form; } function test_page() { return drupal_get_form('test_myform'); } function test_myform_validate($form, &$form_state) { if ($form_state['values']['name'] == '') { form_set_error('', t('Es muss ein Suchbegriff eingegeben werden.')); } } function test_myform_submit($form, &$form_state) { $form_state['storage']['values'] = $form_state['values']; $arg = $form_state['values']['name']; $sql = 'select title, artist, album, id, duration from sambc.songlist where title like "%%%s%%" or artist like "%%%s%%" or album like "%%%s%%" order by artist, title, album'; $db_result = db_query($sql, array($arg, $arg, $arg)); $header = array('Titel', 'Album', array('data' => 'Länge', 'style' => 'text-align:right;'), ''); $rows[] = array(); $i = 0; while($row = db_fetch_object($db_result)) { $data = array(); $ss = round($row->duration / 1000); $mm = (int)($ss / 60); $ss = ($ss % 60); if($ss<10) $ss="0$ss"; $laenge = array('data' => "$mm:$ss", 'align' => 'right'); $data[] = (empty($row->artist) ? $row->title : $row->artist . ' - ' . $row->title); $data[] = $row->album; $data[] = $laenge; $data[] = 'Will ich hören'; $rows[] = $data; $i++; } $output = '

Suchergebnisse:

' . theme_table($header, $rows) . '
' . $i . ' Titel gefunden'; $form_state['storage']['results'] = $output; } echo l('Klicke hier, um den Stream abzuspielen', $stream_url, array('external' => TRUE)); echo '

Nach Liedern suchen:

'; echo '
' . test_page() . '
'; ?>

Als nächstes wird gespielt:

'Länge', 'style' => 'text-align:right;')); $rows = array(); $i = 0; while($row = db_fetch_object($result)) { $data = array(); if (empty($row->artist)) { $data[] = $row->title; } else { $data[] = $row->artist . " - " . $row->title; } $data[] = $row->album; $ss = round($row->duration / 1000); $mm = (int)($ss / 60); $ss = ($ss % 60); if($ss<10) $ss="0$ss"; $data[] = array('data' => "$mm:$ss", 'align' => 'right'); $rows[] = $data; $i++; } $output .= theme('table', $header, $rows); echo $output; ?>

Gerade wird und wurde gespielt:

'Länge', 'style' => 'text-align:right;')); $rows = array(); $i = 0; $listeners = 0; while($row = db_fetch_object($result)) { if ($i == 0) { $listener = $row->listeners; $starttime = strtotime($row->date_played); $curtime = time(); $timeleft = $starttime + round($row->duration / 1000) - $curtime; if ($timeleft > 0) { $timeout = $timeleft; } else { $timeout = 90; } if (($timeout > 180) or ($timeout == 0)) { $timeout = 180; } else if ($timeout < 30) { $timeout = 30; } $refreshURL = "?buster=".date('dhis').rand(1,1000); } $data = array(); if (empty($row->artist)) { $data[] = $row->title; } else { $data[] = $row->artist . " - " . $row->title; } $data[] = $row->album; $ss = round($row->duration / 1000); $mm = (int)($ss / 60); $ss = ($ss % 60); if($ss<10) $ss="0$ss"; $data[] = array('data' => "$mm:$ss", 'align' => 'right'); $rows[] = $data; $i++; } $output .= theme('table', $header, $rows); echo $output; ?> Aktuell Zuhörer.