Subversion Repositories computer_asset_manager_v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
53 rodolico 1
<?php
2
   require_once( 'camp.class.php' );
3
 
4
   class Device extends Camp {
5
      protected static $dbStructure = array(
6
         'table' => array(
7
            'tableName' => 'device',
8
            'primaryKey' => 'device_id',
9
            'selectionDisplay' => 'name',
10
            'fields' => array(
56 rodolico 11
                  'id' => array (
12
                     'fieldname' => 'device_id',
53 rodolico 13
                     'displayName' => 'ID',
14
                     'type' => 'int unsigned',
63 rodolico 15
                     'nullable' => false,
16
                     'canEdit' => false
53 rodolico 17
                  ),
18
                  'name' => array (
56 rodolico 19
                     'fieldname' => 'name',
20
                     'displayName' => 'Name',
53 rodolico 21
                     'type' => 'varchar',
22
                     'size' => 64,
23
                     'list' => true
24
                  ),
25
                  'uuid' => array (
56 rodolico 26
                     'fieldname' => 'uuid',
53 rodolico 27
                     'displayName' => 'UUID',
28
                     'type' => 'varchar',
29
                     'size' => 36,
30
                     'list' => false
31
                  ),
32
                  'serial' => array (
56 rodolico 33
                     'fieldname' => 'serial',
34
                     'displayName' => 'Serial',
53 rodolico 35
                     'type' => 'varchar',
36
                     'size' => 36,
37
                     'list' => false
38
                  ),
39
                  'created' => array (
56 rodolico 40
                     'fieldname' => 'created',
53 rodolico 41
                     'displayName' => 'Created',
42
                     'type' => 'date'
43
                  ),
44
                  'removed' => array(
56 rodolico 45
                     'fieldname' => 'removed',
53 rodolico 46
                     'displayName' => 'Removed',
47
                     'type' => 'date'
59 rodolico 48
                  ),
49
                  'device_types' => array(
50
                     'fieldname' => 'device_types',
51
                     'displayName' => 'Device Type',
64 rodolico 52
                     'type' => '1:M',
65 rodolico 53
                     'linkageTable' => 'device_device_type',
54
                     'linkageColumn' => 'device_id',
55
                     'foreignTable' => 'device_type',
56
                     'foreignColumn' => 'device_type_id',
57
                     'foreignDisplayColumn' => 'name'
59 rodolico 58
                  ),
59
                  'parent' => array(
60
                     'fieldname' => 'parent_id',
61
                     'class' => 'Device',
64 rodolico 62
                     'displayName' => 'Parent',
63
                     'displayColumn' => 'parent',
64
                     'type' => '1:1H',
65 rodolico 65
                     'linkageTable' => 'device_device',
66
                     'linkageColumn' => 'device_id',
67
                     'foreignColumn' => 'parent_id',
68
                     'foreignTable' => 'device'
59 rodolico 69
                  ),
70
                  'owner' => array(
71
                     'fieldname' => 'owner_id',
72
                     'class' => 'Owner',
64 rodolico 73
                     'displayName' => 'Owner',
74
                     'displayColumn' => 'owner',
75
                     'type' => '1:1H',
65 rodolico 76
                     'linkageTable' => 'owner_device',
77
                     'linkageColumn' => 'device_id',
78
                     'foreignColumn' => 'owner_id',
79
                     'foreignTable' => 'owner'
59 rodolico 80
                  ),
81
                  'location' => array(
64 rodolico 82
                     'fieldname' => 'location_id',
83
                     'class' => 'Location',
59 rodolico 84
                     'displayName' => 'Location',
64 rodolico 85
                     'displayColumn' => 'location',
86
                     'type' => '1:1H',
65 rodolico 87
                     'linkageTable' => 'location_device',
88
                     'linkageColumn' => 'device_id',
89
                     'foreignColumn' => 'location_id',
90
                     'foreignTable' => 'location'
59 rodolico 91
                  ),
53 rodolico 92
               ) // fields
56 rodolico 93
            ), // table
94
            'view' => array(
95
               'viewName' => 'view_device_location_owner_type',
96
               'primaryKey' => 'device_id',
97
               'selectionDisplay' => 'device',
98
               'fields' => array(
99
                  'removed' => array( 
100
                     'fieldname' => 'device_removed'
101
                  )
102
               )
59 rodolico 103
            ), // view
104
            'children' => array(
64 rodolico 105
               'Device' => array(
106
                  'filter' => 'parent_id = ~~device_id~~',
107
                  'name' => 'Children'
108
                  )
59 rodolico 109
            ) // children
53 rodolico 110
         ); // dbStructure
111
 
59 rodolico 112
   } // class Device
53 rodolico 113
?>