Rev 78 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
require_once( 'camp_module_install_class.php' );
$installer = new Camp_Install; // this does all the work, all we have to do is define it
$sqlFile = realpath( dirname( __FILE__ ) . '/attributes.sql' ); // the SQL file to build tables
// a hash that defines the new menu entries
$menu = array(
array(
'parent' => null,
'caption' => 'Attributes',
'url' => null,
'shortname' => 'attribute'
),
array(
'parent' => 'attribute',
'caption' => 'Bulk Load',
'url' => '/index.php?module=Attributes&action=load',
'shortname' => 'attribute_load'
),
array(
'parent' => 'attribute',
'caption' => 'Load dmidecode file',
'url' => '/index.php?module=Attributes&action=dmidecode',
'shortname' => 'attribute_dmi'
)
);
// another hash to define new permissions
$permissions = array (
array(
'category' => 'Attributes',
'name' => 'attribute',
'description' => 'Attributes Menu',
'default' => 1
),
array(
'category' => 'Attributes',
'name' => 'attributes_edit',
'description' => 'Edit Attribute',
'default' => 1
),
array(
'category' => 'Attributes',
'name' => 'attributes_add',
'description' => 'Add Attribute',
'default' => 1
),
array(
'category' => 'Attributes',
'name' => 'attributes_del',
'description' => 'Delete Attribute',
'default' => 0
),
array(
'category' => 'Attributes',
'name' => 'attribute_load',
'description' => 'Bulk Load Attribute',
'default' => 1
),
array(
'category' => 'Attributes',
'name' => 'attribute_dmi',
'description' => 'Load dmidecode file',
'default' => 1
),
);
if ( file_exists( $sqlFile ) ) {
$sql = file_get_contents( $sqlFile );
$installer->doSQL( $sql );
}
$installer->addMenu( $menu );
$installer->addPermission( $permissions );
// installer->makeStorage( 'path/to/something' );
$installer->enableModule ( 'attributes' );
?>