Location: PHPKode > projects > HelpCORE > helpcore/module_helpcore_secure/hardware_types.php
<?php

/*
 * HelpCORE source file 
 * ====================
 * 
 * CVS:
 * ----
 * $header$
 * 
 * Purpose:
 * --------
 * Mananages hardware types, which are used by hardware and hardware configurations
 * 
 * Copyright:
 * ----------
 * Copyright (C) 2002-2003 Dennis Fleurbaaij <hide@address.com>
 * Copyright (C) 2002-2005 IO Software <hide@address.com>
 * 
 * This program is free software; you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software Foundation;
 * either version 2 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
 * PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this
 * program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, 
 * Cambridge, MA 02139, USA.
 * 
 * Please note that this software is dual licensed. For the commercial use of this 
 * software you will need a Commercial License. Please see http://www.io-software.nl
 * for the terms and conditions.
 * 
 * For more information you can contact IO Software at http://www.io-software.nl
 */ 
 
if ( ! include_once( '../coreapm/coreapm.php' ) ) {
	die( 'Cannot include CORE APM' );
} 

if( ! include( 'hardware_types_callbacks.php' ) ) {
	__FATAL__( __FILE__, __LINE__, __CLASS__, __FUNCTION__, 'Cannot load callbacks' );	
}

$GLOBALS['security']->secure();
$GLOBALS['coreapm']->start();

include_once( 'configuration_functions.php' );
include_once( 'knowledge_base_functions.php' );

if( USE_HARDWARE_CONFIGS )
{
	$GLOBALS['box']->add( text( 'notice' ), text( 'hardware_spicies_explain' ) );
} 

$limits = 0;
if ( ! $GLOBALS['security']->is_admin )
{
	$limits = NO_ADD | NO_EDIT | NO_DELETE;
} 

if( USE_HARDWARE_CONFIGS )
{ 
	// Shows if a hardware_type is used by a configuration
	function is_used( $value, &$row )
	{
		if ( file_exists( 'config_' . secure_name( $row['name'] ) . '.php' ) )
			return show_boolean( true );

		return show_boolean( false );
	} 
} 

$GLOBALS['relational']->add_table_column( 'name', text( 'name' ), TYPE_STRING( 255 ) | REL_UNIQUE | REL_OBLIGATORY );

if( USE_COMPUTER_INSPECTOR )
{
	$GLOBALS['relational']->add_table_column( 'ci_ok', text( 'ci_ok' ), TYPE_BOOLEAN );
} 

if( USE_NETWORK )
{
	$GLOBALS['relational']->add_table_column( 'network_ok', text( 'network_ok' ), TYPE_BOOLEAN );

	//if( O_NETWORK_SNMP )
	//{
	//	$GLOBALS['relational']->add_table_column( 'snmp_ok', text( 'snmp_ok' ), TYPE_BOOLEAN );
	//} 
} 

if( USE_HARDWARE_CONFIGS )
{
	$GLOBALS['relational']->add_table_column( '', text( 'in_use' ), NOT_IN_TABLE | INLINE_FUNCTION( 'is_used' ) );
} 

$GLOBALS['relational']->add_table_column( 'description', text( 'description' ), TYPE_STRING( 255 ) );
$GLOBALS['relational']->manage( 'hardware_types', text( 'hardware_spicies' ), $limits );

$GLOBALS['coreapm']->finish();

?>
Return current item: HelpCORE