Subversion Repositories computer_asset_manager_v2

Rev

Rev 78 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
78 rodolico 1
<?php
2
 
79 rodolico 3
   require_once( 'camp_module_install_class.php' );
4
 
5
   $installer = new Camp_Install; // this does all the work, all we have to do is define it
6
 
7
   $sqlFile = realpath( dirname( __FILE__ ) . '/attributes.sql' ); // the SQL file to build tables
8
 
9
   // a hash that defines the new menu entries
10
   $menu = array(
11
      array( 
12
         'parent' => null,
13
         'caption' => 'Attributes',
14
         'url' => null,
15
         'shortname' => 'attribute'
16
      ),
17
      array( 
18
         'parent' => 'attribute',
19
         'caption' => 'Bulk Load',
20
         'url' => '/index.php?module=Attributes&action=load',
21
         'shortname' => 'attribute_load'
22
      ),
23
      array( 
24
         'parent' => 'attribute',
25
         'caption' => 'Load dmidecode file',
26
         'url' => '/index.php?module=Attributes&action=dmidecode',
27
         'shortname' => 'attribute_dmi'
28
      )
29
   );
30
 
31
   // another hash to define new permissions
32
   $permissions = array (
33
      array(
34
         'category' => 'Attributes',
35
         'name' => 'attribute',
36
         'description' => 'Attributes Menu',
37
         'default' => 1
38
      ),
39
      array(
40
         'category' => 'Attributes',
41
         'name' => 'attributes_edit',
42
         'description' => 'Edit Attribute',
43
         'default' => 1
44
      ),
45
      array(
46
         'category' => 'Attributes',
47
         'name' => 'attributes_add',
48
         'description' => 'Add Attribute',
49
         'default' => 1
50
      ),
51
      array(
52
         'category' => 'Attributes',
53
         'name' => 'attributes_del',
54
         'description' => 'Delete Attribute',
55
         'default' => 0
56
      ),
57
      array(
58
         'category' => 'Attributes',
59
         'name' => 'attribute_load',
60
         'description' => 'Bulk Load Attribute',
61
         'default' => 1
62
      ),
63
      array(
64
         'category' => 'Attributes',
65
         'name' => 'attribute_dmi',
66
         'description' => 'Load dmidecode file',
67
         'default' => 1
68
      ),
69
 
70
   );
71
 
72
 
78 rodolico 73
   if ( file_exists( $sqlFile ) ) {
74
      $sql = file_get_contents( $sqlFile );
79 rodolico 75
      $installer->doSQL( $sql );
78 rodolico 76
   }
77
 
79 rodolico 78
   $installer->addMenu( $menu );
79
   $installer->addPermission( $permissions );
80
   // installer->makeStorage( 'path/to/something' );
81
   $installer->enableModule ( 'attributes' );
82
 
78 rodolico 83
?>