summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui/views/scripts/index/index.phtml
blob: f12e93cf96ec6b640a2c99d311e328fd7573d060 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php if(isset($this->entries)):?>
	<script type="text/javascript">
	var activeElement = 0;
	$(document).ready(function(){	
		$('.menu').click(function(){
			$('.menu').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startball").attr('src','/media/img/button-green.png');
		});
		$('.menu').eq(activeElement).click();
		$('#startbutton').focus();
		$('.menu').dblclick(function(){
			$('.menu').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startball").attr('src','/media/img/button-green.png');
			start();
		});
		
		$(function() {
			$(document).keyup(function (event) {
				//console.log(activeElement);
				if (event.keyCode == 38) {
					// up
					if(activeElement >=1)
						activeElement = activeElement-1;
					$('.menu').eq(activeElement).click();
					$('#startbutton').focus();

				} else if (event.keyCode == 40) {
					// Down
					if(activeElement < $('.menu').length-1 )					
						activeElement = activeElement+1;					
					$('.menu').eq(activeElement).click();
					$('#startbutton').focus();
				}
				//console.log(activeElement);
			});
		});

	});
	function start(){		
		if($('#selectedBootOs').val() != ''){
			window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
		}
		else{
			alert('You have to select a BootOs');
		}
	}
	</script>
	<h1>Bootmenu</h1>
	<?php $first = true; ?>
	<?php foreach($this->entries as $entry):?>
		<?php
			$bootosMapper = new Application_Model_BootOsMapper();
			$bootos = new Application_Model_BootOs();
			$bootos = $bootosMapper->find($entry->getBootosID());
			
		?>
		<div id="menu_item_1" class="menu"  class="flexbox"> 
			<img src="/media/img/os/ubuntu.png" /> 
			<h2><?php echo $entry->getTitle(); ?></h2>
			<i>BootOs-Name: <?php echo $bootos->getTitle();?></i> 
			<p>Description: <?php echo $bootos->getDescription();?></p> 
			<input type="hidden" class="id" value="<?php echo $entry->getID();?>"/> 
		</div> 
	<?php endforeach; ?>
	<input style="display:none;" type='text' id="selectedBootOs" />
	<button style='cursor:pointer;float:right;margin-top:10px;' id='startbutton' onClick="start();"><img id='startball' src='/media/img/button-red.png'> <span style='font-size:14px;'>Start System</span></button>
	<div class='clear'></div>
<?php endif;?>