mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	* Implement an autoloader When cleaning up classes for psr2, things got a bit unwieldy, so I implemented a class autoloader. I created a PSR-0 compliant LibreNMS directory and moved all classes there that made sense. Implemented LibreNMS\ClassLoader which supports adding manual class mappings This reduces the file includes needed and only loads classes when needed. * Add teh autoloader to graph.php * Add a small bit of docs Fix incomplete class in includes/discovery/functions.inc.php
		
			
				
	
	
		
			39 lines
		
	
	
		
			922 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			922 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| $OBJCOMP = new LibreNMS\Component();
 | |
| 
 | |
| $common_output[] = '
 | |
| <div>
 | |
|     <table id="component-status" class="table table-hover table-condensed table-striped">
 | |
|         <thead>
 | |
|             <tr>
 | |
|                 <th data-column-id="status" data-order="desc">Status</th>
 | |
|                 <th data-column-id="count">Count</th>
 | |
|             </tr>
 | |
|         </thead>
 | |
|         <tbody>
 | |
| ';
 | |
| foreach ($OBJCOMP->getComponentStatus() as $k => $v) {
 | |
|     if ($k == 0) {
 | |
|         $status = 'Ok';
 | |
|         $color = 'green';
 | |
|     } elseif ($k == 1) {
 | |
|         $status = 'Warning';
 | |
|         $color = 'grey';
 | |
|     } else {
 | |
|         $status = 'Critical';
 | |
|         $color = 'red';
 | |
|     }
 | |
|     $common_output[] .= '
 | |
|             <tr>
 | |
|                 <td><p class="text-left '.$color.'">'.$status.'</p></td>
 | |
|                 <td><p class="text-left '.$color.'">'.$v.'</p></td>
 | |
|             </tr>
 | |
| ';
 | |
| }
 | |
| $common_output[] .= '
 | |
|         </tbody>
 | |
|     </table>
 | |
| </div>
 | |
| ';
 |