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',
69 rodolico 10
            'inactiveField' => 'removed',
53 rodolico 11
            'fields' => array(
56 rodolico 12
                  'id' => array (
13
                     'fieldname' => 'device_id',
53 rodolico 14
                     'displayName' => 'ID',
15
                     'type' => 'int unsigned',
63 rodolico 16
                     'nullable' => false,
17
                     'canEdit' => false
53 rodolico 18
                  ),
19
                  'name' => array (
56 rodolico 20
                     'fieldname' => 'name',
21
                     'displayName' => 'Name',
53 rodolico 22
                     'type' => 'varchar',
23
                     'size' => 64,
24
                     'list' => true
25
                  ),
26
                  'uuid' => array (
56 rodolico 27
                     'fieldname' => 'uuid',
53 rodolico 28
                     'displayName' => 'UUID',
29
                     'type' => 'varchar',
30
                     'size' => 36,
31
                     'list' => false
32
                  ),
33
                  'serial' => array (
56 rodolico 34
                     'fieldname' => 'serial',
35
                     'displayName' => 'Serial',
53 rodolico 36
                     'type' => 'varchar',
37
                     'size' => 36,
38
                     'list' => false
39
                  ),
40
                  'created' => array (
56 rodolico 41
                     'fieldname' => 'created',
53 rodolico 42
                     'displayName' => 'Created',
43
                     'type' => 'date'
44
                  ),
45
                  'removed' => array(
56 rodolico 46
                     'fieldname' => 'removed',
53 rodolico 47
                     'displayName' => 'Removed',
48
                     'type' => 'date'
59 rodolico 49
                  ),
50
                  'device_types' => array(
51
                     'fieldname' => 'device_types',
52
                     'displayName' => 'Device Type',
64 rodolico 53
                     'type' => '1:M',
65 rodolico 54
                     'linkageTable' => 'device_device_type',
55
                     'linkageColumn' => 'device_id',
56
                     'foreignTable' => 'device_type',
57
                     'foreignColumn' => 'device_type_id',
69 rodolico 58
                     'foreignDisplayColumn' => 'name',
59
                     'displayView' => array (
60
                        'viewName' => 'device_device_types',
61
                        'myField' => 'device_id',
62
                        'displayField' => 'device_types'
63
                     )
59 rodolico 64
                  ),
65
                  'parent' => array(
69 rodolico 66
                     'displayQuery' => 'select b.device_id id, b.name display from device_device a join device b on (a.parent_id = b.device_id) where a.removed is null and a.device_id = ~~id~~',
59 rodolico 67
                     'fieldname' => 'parent_id',
68
                     'class' => 'Device',
64 rodolico 69
                     'displayName' => 'Parent',
69 rodolico 70
                     'displayColumn' => 'name',
64 rodolico 71
                     'type' => '1:1H',
65 rodolico 72
                     'linkageTable' => 'device_device',
73
                     'linkageColumn' => 'device_id',
74
                     'foreignColumn' => 'parent_id',
75
                     'foreignTable' => 'device'
59 rodolico 76
                  ),
77
                  'owner' => array(
78
                     'fieldname' => 'owner_id',
79
                     'class' => 'Owner',
64 rodolico 80
                     'displayName' => 'Owner',
69 rodolico 81
                     'displayColumn' => 'name',
64 rodolico 82
                     'type' => '1:1H',
65 rodolico 83
                     'linkageTable' => 'owner_device',
84
                     'linkageColumn' => 'device_id',
85
                     'foreignColumn' => 'owner_id',
86
                     'foreignTable' => 'owner'
59 rodolico 87
                  ),
88
                  'location' => array(
64 rodolico 89
                     'fieldname' => 'location_id',
90
                     'class' => 'Location',
59 rodolico 91
                     'displayName' => 'Location',
69 rodolico 92
                     'displayColumn' => 'name',
64 rodolico 93
                     'type' => '1:1H',
65 rodolico 94
                     'linkageTable' => 'location_device',
95
                     'linkageColumn' => 'device_id',
96
                     'foreignColumn' => 'location_id',
97
                     'foreignTable' => 'location'
59 rodolico 98
                  ),
53 rodolico 99
               ) // fields
56 rodolico 100
            ), // table
101
            'view' => array(
102
               'viewName' => 'view_device_location_owner_type',
103
               'primaryKey' => 'device_id',
104
               'selectionDisplay' => 'device',
105
               'fields' => array(
106
                  'removed' => array( 
107
                     'fieldname' => 'device_removed'
108
                  )
109
               )
59 rodolico 110
            ), // view
69 rodolico 111
            /*
59 rodolico 112
            'children' => array(
64 rodolico 113
               'Device' => array(
114
                  'filter' => 'parent_id = ~~device_id~~',
66 rodolico 115
                  'name' => 'Children',
69 rodolico 116
                  'view' => array(
117
                     'name' => 'view_device_types',
118
                     'my field' => 'device_id',
119
                     'display field' => 'device_types'
120
                     ),
66 rodolico 121
                  'noAdd' => true
64 rodolico 122
                  )
59 rodolico 123
            ) // children
69 rodolico 124
            */
53 rodolico 125
         ); // dbStructure
126
 
59 rodolico 127
   } // class Device
53 rodolico 128
?>