summaryrefslogblamecommitdiffstats
path: root/application/modules/fbgui/views/scripts/index/index.phtml
blob: 7d65176175aa9b2e2966174b2de37115f0ebb4bc (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                                                            
 
                              
                                     
                                                                 
                                                                                           
                                                                                        

                                                                
                     
                                
                                                                               
                                                                                            
                                                               

                                                                 
                                                                                 
                                                                                                       
                                                             

                                                                     
              
                      






                                                                            




                                                                             
                                                                 


                                                                       

                                                  
                                                             
                                                          
                                                        
                                                                 
                                                         
                                                                     
                                                         
                       
                                                               
                 
                                          
                






























                                                                                                                                

                                                                         
                                                                             
                                                                                 










                                                                                                                                  

                                 
               
 
                                  
                                     
                                                                 




                                                                                           

                                                                               
                                                                                            
                                                               

                                                                 
                                                                                 
                                                                                                       
                                                             

                                                                     
              
                      
                                       




                                      
                                    
                                        

                                                                   
                                                                        
                                                                            




                                                                             
                                                                 


                                                                       
                                                                        
                   
                                                             
                                          

                                                                   

                                                                            
                                                                  
                                                                
                                                                         
                                                                 
                                                                             
                                                                 
                               
                                                                       
                         
                                                  

                                

                              


                                                       
                                                            



                                                                                
                                                                                     

                                                                 
                                                                                                                                
                                                                                                                        
                                                                                     

                                                                 
                                                                  
                                 
                                                       

                           


                                                       
           

















                                                              
                                        
                                                     
                                                                  
                                                                    
                                                                         
                                                                     
                                                                             
                                                                                                
                               
                                                                                                     
                         





                                                             
                                                                                                  


                                                                                                                                            



                                                      


                                                                             
                                                                                                
                  
                                                                                                 
                                                               
                                                                  

                                                                                    


                                                                                                
                
                                                                       


                                                                                                                                  
                                        
              
<?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;?>