Location: PHPKode > projects > phpMUR Multi User Randomizer > tpl/andreas02/cd.tpl.php
<?php

	if (!is_admin()) {
		return;
	}
	$_SESSION['open_tab'] = 'Create CD';

	if (!isset($_SESSION['cd'])) {
		$_SESSION['cd'] = array(
			'max' => 10,
			'min' => 7,
			'size' => '2G',
			'max_per_artist' => 5
		);
	}

	?><h3>Create CD</h3>
	Max Rating:<?php
		$ratings = array();
		for($i=11;$i>=0;$i--) {
			$ratings["$i"] = $i;
		}
		echo $html->select(
			array(
				'onChange' => 'xajax_set_min_max_cd_rating("max",this.options[this.options.selectedIndex].value)'
			),
			$ratings,
			$_SESSION['cd']['max']
		);
	?> Min Rating:<?php
		echo $html->select(
			array(
				'onChange' => 'xajax_set_min_max_cd_rating("min",this.options[this.options.selectedIndex].value)'
			),
			$ratings,
			$_SESSION['cd']['min']
		);
	?> Medium Size:<?php
		echo $html->select(
			array(
				'onChange' => 'xajax_set_medium_size(this.options[this.options.selectedIndex].value)'
			),
			array(
				'32M' => '32 Meg',
				'64M' => '64 Meg',
				'128M' => '128 Meg',
				'184M' => '184 Meg - Mini CD',
				'256M' => '256 Meg',
				'512M' => '512 Meg',
				'650M' => '650 Meg - CD 74 Min',
				'700M' => '700 Meg - CD 80 Min',
				'1G' => '1 Gig',
				'2G' => '2 Gig',
				'4.7G' => '4.7 Gig - DVD'
			),
			$_SESSION['cd']['size']
		),'<br />';

	// max_per_artist
	?>Max Songs Per Artist:<input type="text" size=2 value="<?php echo $_SESSION['cd']['max_per_artist']; ?>" onKeyup="xajax_max_per_artist(this.value);"> <?php
	//checkbox($html, $checked, $text, $label = true, $orient = 'right')
	echo $html->checkbox(
		array(
			'onClick' => "xajax_shuffle_cd(this.checked)",
			'id' => 'shuffle_cd'
		),
		$_SESSION['cd']['shuffle_cd'],
		'Shuffle CD:',
		$label = true,
		$orient = 'right');
	$total = 0;
	if (isset($_SESSION['cd']['files'])) {
		foreach ($_SESSION['cd']['files'] as $f) {
			$total = $total + $f['filesize'];
		}
	}
	ob_start();
	echo '<br />'.fileSize2human($total).' ('.count($_SESSION['cd']['files']).') files are ready to be copied.';?><br /><?php echo '('.$total.' bytes)'; ?><input type="button" value="Copy" onClick="xajax_copy_files_to_tmp_cd_dir(true);" ><input type="button" onClick="xajax_get_cd_files();" value="Get Files For CD"><br /><?php

	$extra = ob_get_clean();
	echo $extra;

	$files_in_cd = glob('cd/*.mp3');
	echo count($files_in_cd)." files in cd/";

	?><div id="copy_status"></div><?php

	?><div id="cd_genres"><?php
		inc('cd_genres.tpl.php',$args);
	?></div><?php

	?><div id="next_cd"><?php
		inc('next_cd.tpl.php',$args);
	?></div><?php
	echo $extra;



	$bad_artists = $db->get_results_assoc("SELECT aid, artist, artist_not_on_cd FROM artists WHERE artist_not_on_cd = 1 ORDER BY artist");

	?><h3>Never Pick Artists</h3><?php
	foreach ($bad_artists as $a) {
		echo $html->checkbox(
					array(
						'onClick' => "xajax_artist_not_on_cd(" . $a['aid'] . ",this.checked)",
						'id' => 'dpa['.$a['aid'].']'
					),
					$a['artist_not_on_cd'],
					$a['artist'],
					true,
					'left'
				),'<br />';
	}

	?><h3>Never Pick Songs</h3><?php
	$bad_files = $db->get_results_assoc("SELECT f.aid, f.fid, artist, title, add_to_cd FROM artists a, files f WHERE add_to_cd = 2 AND f.aid = a.aid ORDER BY artist, title");
	foreach ($bad_files as $f) {
		//checkbox($html, $checked, $text, $label = true, $orient = 'right')
		echo $html->checkbox(
					array(
						'onClick' => "xajax_add_to_cd(" . $f['fid'] . ",this.checked)",
						'id' => 'dp['.$f['fid'].']'
					),
					true,
					$f['artist'].' - '.$f['title'],
					true,
					'left'
				),'<br />';
	}


?><br />
<a onClick="xajax_get_cd_files();">xajax_get_cd_files();</a>
Return current item: phpMUR Multi User Randomizer