1<?php 2 /**************************************************************************\ 3 * phpGroupWare - phpgw_dj * 4 * http://www.phpgroupware.org * 5 * Written by Joseph Engo <jengo@phpgroupware.org> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: request.php 17479 2006-10-24 06:53:06Z skwashd $ */ 14 15 $GLOBALS['phpgw_info']['flags'] = array( 16 'currentapp' => 'dj', 17 'enable_nextmatchs_class' => True 18 ); 19 include_once('../header.inc.php'); 20 21 $song_id = (int) isset($_REQUEST['song_id']) ? $_REQUEST['song_id'] : 0; 22 $songlist = isset($_REQUEST['songlist']) ? $_REQUEST['songlist'] : ''; 23 24 if ($song_id) 25 { 26 $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_dj_songlist WHERE song_id = $song_id",__LINE__,__FILE__); 27 $GLOBALS['phpgw']->db->next_record(); 28 29 $song_name = $GLOBALS['phpgw']->db->f('song_name'); 30 31 $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_dj_que (que_song) VALUES ('" . $GLOBALS['phpgw']->db->db_addslashes($song_name) . "')",__LINE__,__FILE__); 32 } 33 else if ( count($songlist) ) 34 { 35 $list = unserialize(rawurldecode($songlist)); 36 37 if ( !is_array($list) ) 38 { 39 $list = array(); 40 } 41 42 foreach ( $list as $song_id ) 43 { 44 //echo '<br>' . $song_id; 45 $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_dj_songlist WHERE song_id=' . (int)$song_id,__LINE__,__FILE__); 46 $GLOBALS['phpgw']->db->next_record(); 47 48 $song_name = $GLOBALS['phpgw']->db->f('song_name', true); 49 50 $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_dj_que (que_song) VALUES ('" . $GLOBALS['phpgw']->db->db_addslashes($song_name) . "')",__LINE__,__FILE__); 51 } 52 } 53 54 $GLOBALS['phpgw']->template->set_file(array('request' => 'request.tpl')); 55 $GLOBALS['phpgw']->template->set_block('request','list','list'); 56 $GLOBALS['phpgw']->template->set_block('request','row','row'); 57 58 $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); 59 $GLOBALS['phpgw']->template->set_var('message',lang('The following songs are in the queue to be played')); 60 $GLOBALS['phpgw']->template->set_var('lang_title',lang('Title')); 61 $GLOBALS['phpgw']->template->set_var('lang_artist',lang('Artist')); 62 $GLOBALS['phpgw']->template->set_var('lang_year',lang('Year')); 63 $GLOBALS['phpgw']->template->set_var('lang_genre',lang('Genre')); 64 $GLOBALS['phpgw']->template->set_var('lang_time',lang('Time')); 65 66 $db2 = $GLOBALS['phpgw']->db; 67 $GLOBALS['phpgw']->db->query("select * from phpgw_dj_que order by que_id asc",__LINE__,__FILE__); 68 while ($GLOBALS['phpgw']->db->next_record()) 69 { 70 $db2->query("select * from phpgw_dj_songlist where song_name='" . $GLOBALS['phpgw']->db->db_addslashes($GLOBALS['phpgw']->db->f('que_song')) . "'",__LINE__,__FILE__); 71 $db2->next_record(); 72 $totaltime = $totaltime + $db2->f('song_length'); 73 74 $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template); 75 $GLOBALS['phpgw']->template->set_var('row_title',trim($db2->f('song_title', true))); 76 $GLOBALS['phpgw']->template->set_var('row_artist',trim($db2->f('song_artist', true))); 77 $GLOBALS['phpgw']->template->set_var('row_year',trim($db2->f('song_year'))); 78 $GLOBALS['phpgw']->template->set_var('row_genre',trim($db2->f('song_genre'))); 79 $GLOBALS['phpgw']->template->set_var('row_time',date('i:s',$db2->f('song_length'))); 80 81 $GLOBALS['phpgw']->template->parse('rows','row',True); 82 } 83 $GLOBALS['phpgw']->template->set_var('lang_totaltime',lang('Total time')); 84 $GLOBALS['phpgw']->template->set_var('value_totaltime',date('i:s',$totaltime)); 85 $GLOBALS['phpgw']->template->set_var('value_done','<a href="' . $GLOBALS['phpgw']->link('/dj/index.php','cat_id='.$cat_id) . '">' . lang('Done') . '</a>'); 86 87 $GLOBALS['phpgw']->template->pfp('out','list'); 88 89 $GLOBALS['phpgw']->common->phpgw_footer(); 90?> 91