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

















                                                        
                                                 
                             



                                                                   

                                                        
                                                                        
                                                               



                                                                                   

                                                                                          

                                                          
                                                                                                              

                                                                        
                                                               



                                                                                                        

                                                                                          

                                                          
                                                                                                                  

                                                                         
                                                               



                                                                                     

                                                                                          

                                                          
                                                                                                               
                                              



                                                                                                                        
                          













                                                                                                                                            



                                                                                             

                                                                                        
                                                                                                        









                                                                                                                                    
                                                                              

                                                                             
                                                                                         
                                                                                                                                
                                                                                        
                                                                                                                                                                
                                                                                         
                                                                                                                                

                                                                                                                                   

                                                                                                                                                                   




                                                                         

                                                                







                                         
                                                                                                       





                                                                                                                                                        
                                                                                    



                                                   


                                                                       

                                                                
                                                                                
                                                                                                                     















                                                                                                                                      
                                                      


                                                                
                                                                                                                          



                                                                                                                          
                                                                   


                                                                                                                             





                                                 
      
                                                                              
                               






                                                            




















                                                                                         
                                                                     
                                                      
                                                                             
                                                                                                     

                                                                                                                                                             








                                                                                        
                                                                                


                                                                                
                                                                                                             







                                     
                                             







                                                             
              
 
<h1>Pools</h1>
<?php if($this->notification != ''){echo $this->notification;} ?>
<?php echo $this->searchform; ?>
<?php if(Pbs_Acl::checkRight('poc')): ?>
<?php echo $this->formButton('createconfig', 'Create Pool', array(
							'onclick' => 'self.location="/user/pool/createpool/page/'.$this->page.'"',
							'class' => 'addbutton'))?>
<?php endif;?>
<div class='searchvars'>
	<div class='head'>Available searchfilter:</div>
	<div class='code'>bootosID</div>
	<div class='code'>title</div>
	<div class='code'>groupID</div>
	<div class='code'>configID</div>
	<div class='code'>init</div>
	<div class='code'>kernel</div>
	<div class='code'>kcl</div>
	<div class='code'>description</div>
	<div class='code'>changed</div>
	<div class='code'>expires</div>
	<div class='code'>public</div>
</div>

<div class='listelement'>
	<?php if(count($this->pools)==0)
		echo "There are no Pools to display." ?>
	<?php foreach ($this->pools as $pool): ?>
	<div class='element'>
  		<div class='number'>  		
			<div class='smallnumber'>Pool</div>
  			<?php echo $this->escape($pool->getID()) ?>
  		</div>
  		<div class='content'>  			
	  		<div class='actions'>
	  			<?php if(Pbs_Acl::checkRight('poe')): ?>
	  			<a href="<?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'pool',
							'action'     => 'editpool',
							'poolID'	=> $pool->getID(),
							'page'		=> $this->page
						),
						'default',
						true) ?>"><img src='/media/img/edit.png' alt='Edit Pool'/></a>
				<?php endif;?>
				<?php if(Pbs_Acl::checkRight('pod')): ?>
		  		<a href="<?php echo $this->url(
						array(							
							'module'	=> 'user',
							'controller' => 'pool',
							'action'     => 'deletepool',
							'poolID'	=> $pool->getID(),
							'page'		=> $this->page
						),
						'default',
						true) ?>"><img src='/media/img/delete.png' alt='Delete Pool'/></a>
				<?php endif;?>
				<?php if(Pbs_Acl::checkRight('polc')): ?>
	  			<a href="<?php echo $this->url(
						array(
							'module'	=> 'user',
							'controller' => 'pool',
							'action'     => 'linkclient',
							'poolID'	=> $pool->getID(),
							'page'		=> $this->page
						),
						'default',
						true) ?>"><img src='/media/img/add.png' alt='Link Client'/></a>
				<?php endif;?>
	  		</div>  
	  		<?php		
				$poolentriesMapper = new Application_Model_PoolEntriesMapper();
				$clients = $poolentriesMapper->findBy(array('poolID' => $pool->getID()),true);		
			?>
	  		<div class='title'><?php echo $this->escape($pool->getTitle()) ?></div>
	  		<div class='subtitle'><?php echo $this->escape($pool->getLocation()) ?> - <?php echo count($clients);?> Clients<br/>
	  		<?php echo $this->escape($pool->getDescription()) ?></div>
	  		<div class='details dispnone'>				
				
				<?php if (count($clients)>0): ?>
					<?php
					foreach ($clients as $client): ?>
						<?php
							$cli = new Application_Model_Client();
							$clientMapper = new Application_Model_ClientMapper();
							$clientMapper->find($client['clientID'],$cli);			
						?>
					<div class='element'>
						<div class='number'>
							<div class='smallnumber'>Client</div>
							<?php echo $client['clientID'];?>
						</div>
						<div class='content'>  			
					  		<div class='actions'>
					  			<?php if(Pbs_Acl::checkRight('pouc')):?>
					  			<a href="<?php echo $this->url(
								array(
									'module'	=> 'user',
									'controller' => 'pool',
									'action'     => 'unlinkclient',
									'poolentriesID'	=> $client['poolentriesID'],
									'page'		=> $this->page
								),
								'default',
								true) ?>"><img src='/media/img/delete.png' alt='Unlink Client'/></a>
								<?php endif;?>
					  		</div>  
					  		<div class='details'>
					  			<label>MacAddress</label>
					  				<div class='item'><?php echo ($cli->macAdress); ?></div>
					  			<label>IpAddress</label>
					  				<div class='item'><?php echo ($cli->ip); ?>&nbsp;</div>		  			
					  			<label>Ip6Address</label>
					  				<div class='item'><?php echo ($cli->ip6); ?>&nbsp;</div>
					  			<label>Hardwarehash</label>
					  				<div class='item'><?php echo ($cli->hardwarehash); ?></div>
					  			<label>Created</label>
					  				<div class='item'><?php echo date(Zend_Registry::get('dateformat'),$cli->created); ?></div>
					  		</div>
				  		</div>
				  		<div class='clear'></div>
					</div>
					<?php endforeach ?> 
					<?php endif;?>
  				</div>	  			
  			</div>
  		<div class='clear'></div>
	</div>
	<?php endforeach ?> 
</div>    

<?php echo $this->pagination; ?>

<?php if (isset($this->freeclients) && count($this->freeclients)>0 && Pbs_Acl::checkRight('posuc')): ?>
	<h2 style='margin-top:20px;'>Free clients</h2>
	<p style="text-align:right;">
		<span style="font-weight:bold;">Search:</span> <input type="text" id="txtSearch" name="txtSearch" maxlength="50" />&nbsp; 
		<img id="imgSearch" src="/media/img/delete.png" alt="Cancel Search" title="Cancel Search" style="width:150px;width:14px;height:14px;" />
	</p>

<div style="height: 200px; overflow: scroll; overflow-x: hidden;padding-right:5px;">
	<div class='listelement' id='tblSearch'>
	<?php
	foreach ($this->freeclients as $client): ?>
		<div class='element'>
	  		<div class='number'>
				<div class='smallnumber'>Client</div>
	  			<?php echo $client['clientID'];?></div>
	  		<div class='content'>  			
		  		<div class='actions'>
		  			<?php if(Pbs_Acl::checkRight('polc')):?>
		  			Pool:<select onChange="location.href=this.options[this.selectedIndex].value">
						<option></option>
						<?php foreach ($this->pools as $pool): ?>
							<option value="<?php echo $this->url(
									array(
										'module'	=> 'user',
										'controller' => 'pool',
										'action'     => 'linkclient',
										'clientID'	=> $client['clientID'],
										'poolID'	=> $pool->getID(),
										'page'		=> $this->page
									),
									'default',
									true) ?>"><?php echo $pool->getTitle(); ?></option>
								<?php //<img src='/media/img/add.png' alt='Link to Pool'/></a></td> ?>
						<?php endforeach ?>			
					</select>
					<?php endif;?>
		  		</div>
		  		<div class='details'>
		  			<label>MacAdress</label>
		  				<div class='item'><?php echo $this->escape($client['macadress']); ?></div>
		  			<label>IpAddress</label>
						<div class='item'><?php echo $this->escape($client['ip']); ?>&nbsp;</div>
					<label>Ip6Address</label>
						<div class='item'><?php echo $this->escape($client['ip6']); ?>&nbsp;</div>
		  			<label>HardwareHash</label>
		  				<div class='item'><?php echo $this->escape($client['hardwarehash']); ?></div>
	  			<label>Created</label>
	  				<div class='item'><?php echo $this->escape($client['created']) ?></div>
		  		</div>
	  		</div>
	  		<div class='clear'></div>
		</div>
	<?php endforeach ?> 
	</div>
</div>
<script type='text/javascript' src='/media/js/jquery.highlight-3.js'></script>
<script type="text/javascript">
jQuery.expr[":"].containsNoCase = function(el, i, m) {
	var search = m[3];
	if (!search) return false;
	return eval("/" + search + "/i").test($(el).text());
};
  
	jQuery(document).ready(function() {

		// hide the cancel search image
		jQuery('#imgSearch').hide();

		// reset the search when the cancel image is clicked
		jQuery('#imgSearch').click(function() {
			 resetSearch();
		});

		// cancel the search if the user presses the ESC key
		jQuery('#txtSearch').keyup(function(event) {
			if (event.keyCode == 27) {
			   resetSearch();
		   }
		});
  
		// execute the search
		jQuery('#txtSearch').keyup(function() {
			// only search when there are 3 or more characters in the textbox
			if (jQuery('#txtSearch').val().length > 2) {
				// hide all rows
				jQuery('#tblSearch .element').hide();
				// show the header row
				//jQuery('#tblSearch .element:first').show();
				// show the matching rows (using the containsNoCase from Rick Strahl)
				jQuery('#tblSearch .element .item:containsNoCase(\'' + jQuery('#txtSearch').val() + '\')').parent().parent().parent().show();
				$('#tblSearch .element .item').removeHighlight().highlight(jQuery('#txtSearch').val());
				// show the cancel search image
				jQuery('#imgSearch').show();
			}
			else if (jQuery('#txtSearch').val().length == 0) {
				// if the user removed all of the text, reset the search
				resetSearch();
			}

			// if there were no matching rows, tell the user
			if (jQuery('#tblSearch .element:visible').length == 0) {
				// remove the norecords row if it already exists
				jQuery('.norecords').remove();
				// add the norecords row
				jQuery('#tblSearch').append('<div class="norecords">No records found</div>');
			}
		});
});
 
function resetSearch() {
	// clear the textbox
	jQuery('#txtSearch').val('');
	// show all table rows
	jQuery('#tblSearch .element').show();
	// remove any no records rows
	jQuery('.norecords').remove();
	// remove the cancel search image
	jQuery('#imgSearch').hide();
	// make sure we re-focus on the textbox for usability
	jQuery('#txtSearch').focus();
}
</script>
<?php endif;?>