summaryrefslogtreecommitdiffstats
path: root/application/modules/fbgui/views/scripts/index/index.phtml
blob: d10266cb21493faec1dc49baaf8645c7b91aa3bf (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?php if(count($this->notification) !=  0){ foreach ($this->notification as $n) echo $n;} ?>

<?php if($this->nobootmenu):?>
	<?php if($this->loginmenu):?>
	<div class="fbguilogin selectswitch" style='clear:both'> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
		<i>This is not your Bootmenu. Select this to get your own Bootmenu.</i> 
		<input type="hidden" class="id" value="login"/> 
	</div>
	<?php else:?>
 	<div style='width:100%'>
	    <div class="fbguilogin selectswitch" style='float:left;width:40%'> 
	        <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Logout</div>
	        <i>Logout and get to the default BootMenu.</i> 
	        <input type="hidden" class="id" value="logout"/> 
	    </div>
	    <div class="fbguiswitch selectswitch" style='float:right;width:40%'> 
	        <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Switch Membership</div>
	        <i>Return to the Select Membership Menu.</i> 
	        <input type="hidden" class="id" value="membership"/> 
	    </div>
	</div>
	<?php endif;?>
	<script type="text/javascript">
	var activeElement = 0;
	$(document).ready(function(){	
		$('.selectswitch').click(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			if($('#selectedBootOs').val() == 'login'){
				$("#startbutton").html('Login');
			}else if($('#selectedBootOs').val() == 'logout'){
				$("#startbutton").html('Logout');
			}else if($('#selectedBootOs').val() == 'membership'){
				$("#startbutton").html('Switch');
			} else{
				$("#startbutton").html('Start System');
			}
			$("#startbutton").focus();
		});
		$('.selectswitch').eq(activeElement).click();
		if($('#selectedBootOs').val() == 'login'){
			$("#startbutton").html('Login');
		}else if($('#selectedBootOs').val() == 'logout'){
			$("#startbutton").html('Logout');
		}else if($('#selectedBootOs').val() == 'membership'){
			$("#startbutton").html('Switch');
		} else{
			$("#startbutton").html('Start System');
		}
		$('#startbutton').focus();
		
		$('.selectswitch').dblclick(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			$("#startbutton").focus();
			start();
		});
		
		$(function() {
			$(document).keyup(function (event) {
				if (event.keyCode == 38) {
					// up
					if(activeElement >=1)
						activeElement = activeElement-1;
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 40) {
					// Down
					if(activeElement < $('.selectswitch').length-1 )					
						activeElement = activeElement+1;					
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 13) {
					// Down
					$('#startbutton').click();
				}
			});
		});
	});
	function start(){		
		if($('#selectedBootOs').val() != ''){
			if($('#selectedBootOs').val() == 'login'){
				window.location='/fbgui/auth/login/'
			}else if($('#selectedBootOs').val() == 'logout'){
				window.location='/fbgui/auth/logout/'
			}else if($('#selectedBootOs').val() == 'membership'){
				window.location='/fbgui/person/changemembership/'
			} else{
				window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
			}
		}
		else{
			alert('You have to select a BootOs');
		}
	}
	</script>
	<input style="display:none;" type='text' id="selectedBootOs" />
	<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
	</button>	
	<div class='clear'></div>
<?php endif; ?>

<?php if(isset($this->entries)):?>
	<?php if($this->loginmenu):?>
	<div class="fbguilogin selectswitch" style='clear:both'> 
		<div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Login</div>
		<i>This is not your Bootmenu. Select this to get your own Bootmenu.</i> 
		<input type="hidden" class="id" value="login"/> 
	</div>
	<?php else:?>
 	<div style='width:100%;clear:both'>
	    <div class="fbguilogin selectswitch" style='float:left;width:40%'> 
	        <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Logout</div>
	        <i>Logout and get to the default BootMenu.</i> 
	        <input type="hidden" class="id" value="logout"/> 
	    </div>
	    <div class="fbguiswitch selectswitch" style='float:right;width:40%`:'> 
	        <div style='font-size:16px;font-weight:bold;margin-bottom:5px;'>Switch Membership</div>
	        <i>Return to the Select Membership Menu.</i> 
	        <input type="hidden" class="id" value="membership"/> 
	    </div>
	</div>
	<?php endif;?>
	<script type="text/javascript">
	<?php if($this->loginmenu):?>
		var activeElement = 1;
	<?php else:?>
		var activeElement = 2;
	<?php endif;?>	
	var abortStartcount = false;
	$(document).ready(function(){	
		$('.selectswitch').click(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			if($('#selectedBootOs').val() == 'login'){
				$("#startbutton").html('Login');
			}else if($('#selectedBootOs').val() == 'logout'){
				$("#startbutton").html('Logout');
			}else if($('#selectedBootOs').val() == 'membership'){
				$("#startbutton").html('Switch');
			} else{
				$("#startbutton").html('Start System');
			}
			$("#startbutton").focus();			
		});
		$('.selectswitch').eq(activeElement).click();
		$('#startbutton').focus();
		$('.selectswitch').dblclick(function(){
			$('.selectswitch').removeClass('selected');
			$(this).addClass('selected');			
			$("#selectedBootOs").val($(this).find('.id').val());
			if($('#selectedBootOs').val() == 'login'){
				$("#startbutton").html('Login');
			}else if($('#selectedBootOs').val() == 'logout'){
				$("#startbutton").html('Logout');
			}else if($('#selectedBootOs').val() == 'membership'){
				$("#startbutton").html('Switch');
			} else{
				$("#startbutton").html('Start System');
			}
			$("#startbutton").focus();
			start();
		});
		
		$(function() {
			$(document).click(function(){
				abortStartcount = true;
			})
			$(document).keyup(function (event) {
				if (event.keyCode == 38) {
					// up
					if(activeElement >=1)
						activeElement = activeElement-1;
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 40) {
					// Down
					if(activeElement < $('.selectswitch').length-1 )					
						activeElement = activeElement+1;					
					$('.selectswitch').eq(activeElement).click();
				} else if (event.keyCode == 13) {
					// Down
					$('#startbutton').click();
				}
				abortStartcount = true;
			});
		});
		<?php if(count($this->entries) > 0): ?>
		decreaseDown()
		<?php endif; ?>
	});
	function decreaseDown(){
		var act = parseInt($('.startcounter').html());
		if(act == 0){
			start();
			return;
		}
		var next = act-1;		
		$('.startcounter').html(next);
		if(next == 0){
			start();
		}
		if(next > 0 && abortStartcount == false){
			setTimeout('decreaseDown()',1000);
		}
		if(abortStartcount == true){
			$('.startcounter').parent().fadeOut();
		}
	}
	function start(){		
		if($('#selectedBootOs').val() != ''){
			if($('#selectedBootOs').val() == 'login'){
				window.location='/fbgui/auth/login/'
			}else if($('#selectedBootOs').val() == 'logout'){
				window.location='/fbgui/auth/logout/'
			}else if($('#selectedBootOs').val() == 'membership'){
				window.location='/fbgui/person/changemembership/'		
			} else{
				window.location='/fbgui/index/start/bme/'+$('#selectedBootOs').val();
			}
		}
		else{
			alert('You have to select a BootOs');
		}
	}
	</script>
	<h1 style='padding-top:15px;padding-bottom:6px;clear:both'><?php echo $this->title;?></h1>
	<?php if(count($this->entries) > 0): ?>
	<div style='padding:5px;float:right;'>Starting in <span class='startcounter'><?php echo $this->startcounter; ?></span> seconds</div>
	<?php endif; ?>
	<div class='bootmenu'>
	<?php $first = true; 	
	?>
	<?php foreach($this->entries as $k=>$entry):?>
		<?php
			$bootosMapper = new Application_Model_BootOsMapper();
			$bootos = new Application_Model_BootOs();
			$bootos = $bootosMapper->find($entry->getBootosID());			
		?>
		<div id="menu_item_<?php echo $k;?>" class="menu selectswitch"  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; ?>
	</div>	
	<input style="display:none;" type='text' id="selectedBootOs" />
	<button onClick="start();" id='startbutton' class="fbguistart" style='font-size:16px;font-weight:bold;margin-bottom:5px;'>
		Start System
	</button>	
	<div class='clear'></div>	
<?php endif;?>