ASNMTAP

 view release on metacpan or  search on metacpan

applications/htmlroot/snmptraps/include/classes/class.frontend.php  view on Meta::CPAN

<?
#########################################################
#         SNMPTraps-Frontend for Nagios & ASNMTAP       #
#                                                       #
#                    by Michael Lübben                  #
#                   --- Lizenz GPL ---                  #
#########################################################

/**
* This Class creates the Web-Frontend for the SNMP-Trap Frontend
*/

class frontend {
  	var $site;
	
	/**
	* Constructor
	*
	* @param config $configINI
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/  
    function frontend(&$configINI) {
		$this->configINI = &$configINI;
	}

	// ==================================== Functions to create the page ====================================
	
	/**
	* Open a Web-Site in a Array site[].
	*
	* @author Michael Luebben <michael_luebben@web.de>
    */
	function openSite() {
		$this->site[] = '<HTML>';
		$this->site[] = '<HEAD>';
		$this->site[] = '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8"/>';
		$this->site[] = '<TITLE>'.$this->configINI['internal']['title'].' '.$this->configINI['internal']['version'].'</TITLE>';
		$this->site[] = '<SCRIPT TYPE="text/javascript" SRC="./include/js/nagtrap.js"></SCRIPT>';
		$this->site[] = '<SCRIPT TYPE="text/javascript" SRC="./include/js/overlib.js"></SCRIPT>';
		$this->site[] = '<LINK HREF="'.$this->configINI['nagios']['prefix'].'/include/css/nagtrap.css" REL="stylesheet" TYPE="text/css">';
		$this->site[] = '<LINK HREF="'.$this->configINI['nagios']['prefix'].'/include/css/status.css" REL="stylesheet" TYPE="text/css">';
		$this->site[] = '<LINK HREF="'.$this->configINI['nagios']['prefix'].'/include/css/showlog.css" REL="stylesheet" TYPE="text/css">';
		$this->site[] = '<LINK HREF="'.$this->configINI['nagios']['prefix'].'/include/css/common.css" REL="stylesheet" TYPE="text/css">';
		$this->site[] = '</HEAD>';
		$this->site[] = '<BODY CLASS="status">';
	}
	
	/**
	* Closed a Web-Site in the Array site[]
	*
	* @author Michael Luebben <michael_luebben@web.de>
    */
	function closeSite() {
		$this->site[] = '</BODY>';
		$this->site[] = '</HTML>';
	}
	
	/**
	* Create a Web-Side from the Array site[].
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/
	function printSite() {
		foreach ($this->site as $row) {
			echo $row."\n";
		}
	}
	
	// ======================= Contructor and functions for the header of the frontend ======================
	
	/**
	* Constructor for the header
	*
	* @author Michael Luebben <michael_luebben@web.de>
	*/
	function constructorHeader() {
	    global $table;
		$this->site[] = '<TABLE BORDER="0" WIDTH="100%" CELLPADDING="0" CELLSPACING="0">';
		$this->site[] = '   <TR>';
		$this->site[] = '      <TD ALIGN="left" VALIGN="top" WIDTH="33%">';
		$this->createInfoBox();
		$this->site[] = '         <BR>';
		$this->createFilter();
		$this->site[] = '      </TD>';
		$this->site[] = '      <TD ALIGN="center" VALIGN="top" WIDTH="33%">';
		$this->createNavBox();
		$this->site[] = '         <BR>';
		$this->createDBInfo($table);
		$this->site[] = '      </TD>';
		$this->site[] = '      <TD ALIGN="right" VALIGN="top" WIDTH="33%">';
		$this->createOptBox();
		$this->site[] = '      </TD>';
		$this->site[] = '   </TR>';
		$this->site[] = '</TABLE>';
		$this->site[] = '<BR><BR>';
	}



( run in 0.687 second using v1.01-cache-2.11-cpan-39bf76dae61 )