-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdh.admin.inc
1878 lines (1697 loc) · 63.1 KB
/
dh.admin.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @file
* Model editing UI.
*
* We make very little use of the EntityAPI interface for this - preferring instead to use
* views. That offers more flexibility to change a UI that will, more often than not,
* be end-user facing.
*/
/**
* UI controller.
*/
//****************************
// TimeSeries
//****************************
class dHPropertiesTypeUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['description'] = 'Manage dH Properties types, including adding and removing fields and the display of fields.';
return $items;
}
}
//****************************
// TimeSeries
//****************************
class dHTimeSeriesTypeUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['description'] = 'Manage dH Time Series types, including adding and removing fields and the display of fields.';
return $items;
}
}
//****************************
// Feature
//****************************
class dHFeatureTypeUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['description'] = 'Manage dH Feature types, including adding
and removing fields and the display of fields.';
return $items;
}
}
//****************************
// Borehole Log Type
//****************************
class dHBoreHoleLogTypeUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['description'] = 'Manage dH Borehole log types, including adding
and removing fields and the display of fields.';
return $items;
}
}
//****************************
// Feature
//****************************
class dHFeatureUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
/* $items[$this->path] = array(
'title' => 'dH Feature',
'description' => 'Manage dH entity types, including adding and removing fields and the display of fields.',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('access administration pages'),
'file path' => drupal_get_path('module', 'system'),
'file' => 'system.admin.inc',
);*/
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType),
'page callback' => 'entity_ui_bundle_add_page',
'page arguments' => array($this->entityType),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
$items[$this->path . '/add/%'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType, $this->id_count + 1),
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType, $this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
);
// attempt to create a view page
// not yet working...
$items['view/%dh_feature'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array(1),
'page callback' => 'dh_feature_page_view',
'page arguments' => array(1),
'access arguments' => array('view dh_feature entities'),
'type' => MENU_CALLBACK,
);
if (!empty($this->entityInfo['admin ui']['file'])) {
// Add in the include file for the entity form.
foreach (array('/add', '/add/%') as $path_end) {
$items[$this->path . $path_end]['file'] = $this->entityInfo['admin ui']['file'];
$items[$this->path . $path_end]['file path'] = isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']);
}
}
return $items;
}
}
// dh_feature_page_view Referenced above in dHFeatureUIController hook_menu()
// in attempt to create a view page
// not yet working...
function dh_feature_page_view($dh_feature, $view_mode = 'full'){
$dh_feature->content = array();
// Build fields content.
field_attach_prepare_view('dh_feature', array($dh_feature->hydroid => $dh_feature), $view_mode);
entity_prepare_view('dh_feature', array($dh_feature->hydroid => $dh_feature));
$dh_feature->content += field_attach_view('dh_feature', $dh_feature, $view_mode);
return $dh_feature->content;
}
//****************************
// Hydrogeologic unit
//****************************
class dHHydroGeologicUnitUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
/* $items[$this->path] = array(
'title' => 'dH HydroGeologicUnit',
'description' => 'Manage dH Hydro Geologic types, including adding and removing fields and the display of fields.',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('access administration pages'),
'file path' => drupal_get_path('module', 'system'),
'file' => 'system.admin.inc',
);
*/
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title' => 'Add Hydrogeologic Unit',
'description' => 'A form to enter Hydrogeologic unit',
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType,$this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
return $items;
}
}
//****************************
// Borehole Log
//****************************
class dHBoreHoleLogUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType),
'page callback' => 'entity_ui_bundle_add_page',
'page arguments' => array($this->entityType),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
$items[$this->path . '/add/%'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType, $this->id_count + 1),
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType, $this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
);
// attempt to create a view page
// not yet working...
$items['view/%dh_boreholelog'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array(1),
'page callback' => 'dh_boreholelog_page_view',
'page arguments' => array(1),
'access arguments' => array('view dh_boreholelog entities'),
'type' => MENU_CALLBACK,
);
if (!empty($this->entityInfo['admin ui']['file'])) {
// Add in the include file for the entity form.
foreach (array('/add', '/add/%') as $path_end) {
$items[$this->path . $path_end]['file'] = $this->entityInfo['admin ui']['file'];
$items[$this->path . $path_end]['file path'] = isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']);
}
}
return $items;
}
}
//****************************
// TimeSeries table
//****************************
class dHTimeSeriesTableUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title' => 'Add Time Series Data',
'description' => 'A form to enter Time Series data',
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType,$this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
return $items;
}
}
//****************************
// VariableDefinition table
//****************************
class dHVariableDefinitionUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title' => 'Add Variable Definition Data',
'description' => 'A form to enter Varieable Definition',
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType,$this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
return $items;
}
}
//****************************
// Properties Table
//****************************
class dHPropertiesUIController extends EntityDefaultUIController {
public function hook_menu() {
$items = parent::hook_menu();
// Change the overview menu type for the list of models.
$items[$this->path]['type'] = MENU_LOCAL_TASK;
// Extend the 'add' path.
$items[$this->path . '/add'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType),
'page callback' => 'entity_ui_bundle_add_page',
'page arguments' => array($this->entityType),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
'type' => MENU_LOCAL_ACTION,
);
$items[$this->path . '/add/%'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array('add', $this->entityType, $this->id_count + 1),
'page callback' => 'entity_ui_get_bundle_add_form',
'page arguments' => array($this->entityType, $this->id_count + 1),
'access callback' => 'entity_access',
'access arguments' => array('create', $this->entityType),
);
// attempt to create a view page
// not yet working...
$items['view/%dh_properties'] = array(
'title callback' => 'entity_ui_get_action_title',
'title arguments' => array(1),
'page callback' => 'dh_properties_page_view',
'page arguments' => array(1),
'access arguments' => array('view dh_properties entities'),
'type' => MENU_CALLBACK,
);
if (!empty($this->entityInfo['admin ui']['file'])) {
// Add in the include file for the entity form.
foreach (array('/add', '/add/%') as $path_end) {
$items[$this->path . $path_end]['file'] = $this->entityInfo['admin ui']['file'];
$items[$this->path . $path_end]['file path'] = isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']);
}
}
return $items;
}
}
// FORM Stuff
/**
* dH Feature Type editing form.
*/
function dh_feature_type_form($form, &$form_state, $dh_feature_type, $op = 'edit') {
if ($op == 'clone') {
$dh_feature_type->name .= ' (cloned)';
$dh_feature_type->bundle = '';
}
$form['name'] = array(
'#title' => t('Feature Name'),
'#type' => 'textfield',
'#default_value' => $dh_feature_type->name,
'#description' => t('The human-readable name of this dH Feature type.'),
'#required' => TRUE,
'#size' => 30,
);
// Machine-readable type name.
$form['bundle'] = array(
'#title' => t('Bundle Name'),
'#type' => 'machine_name',
'#default_value' => isset($dh_feature_type->bundle) ? $dh_feature_type->bundle : '',
'#maxlength' => 32,
// '#disabled' => $dh_feature_type->isLocked() && $op != 'clone',
'#machine_name' => array(
'exists' => 'dh_feature_get_types',
'source' => array('label'),
),
'#description' => t('A unique machine-readable name for this model type. It must only contain lowercase letters, numbers, and underscores.'),
);
$form['description'] = array(
'#type' => 'textfield',
'#default_value' => $dh_feature_type->description,
'#description' => t('Detailed description of this dH Feature type.'),
'#required' => FALSE,
'#size' => 255,
);
// $form['data']['#tree'] = TRUE;
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save dH Feature type'),
'#weight' => 40,
);
//Locking not supported yet
///*if (!$dh_feature_type->isLocked() && $op != 'add') {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete model type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array('dh_feature_type_form_submit_delete')
);
//}*/
return $form;
}
/**
* Form API submit callback for the type form.
*/
function dh_feature_type_form_submit(&$form, &$form_state) {
$dh_feature_type = entity_ui_form_submit_build_entity($form, $form_state);
$dh_feature_type->save();
$form_state['redirect'] = 'admin/structure/dh_feature_type';
}
/**
* Form API submit callback for the delete button.
*/
function dh_feature_type_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/structure/dh_feature_type/manage/' . $form_state['dh_feature_type']->bundle . '/delete';
}
/**
* dH Feature editing form.
*/
function dh_feature_form($form, &$form_state, $dh_feature, $op = 'edit') {
if ($op == 'clone') {
$dh_feature->name .= ' (cloned)';
$dh_feature->bundle = '';
}
/* $form['name'] = array(
'#title' => t('Label'),
'#type' => 'textfield',
'#default_value' => $dh_feature->name,
'#description' => t('The human-readable name of this dH Feature type.'),
'#required' => TRUE,
'#size' => 30,
);*/
$form['name'] = array(
'#title' => t('Name'),
'#type' => 'textfield',
'#default_value' => $dh_feature->name,
'#description' => t('Name'),
'#required' => TRUE,
'#size' => 30,
);
$form['ftype'] = array(
'#title' => t('FType'),
'#type' => 'textfield',
'#default_value' => $dh_feature->ftype,
'#description' => t('FType'),
'#required' => TRUE,
'#size' => 30,
);
if (trim($dh_feature->hydrocode) == '') {
$dh_feature->hydrocode = str_replace(' ', '_', strtolower($dh_feature->name ));
}
$form['hydrocode'] = array(
'#title' => t('HydroCode'),
'#type' => 'textfield',
'#default_value' => $dh_feature->hydrocode,
'#description' => t('The unique identifier used by the originating agency of this dH Feature type.'),
'#required' => TRUE,
'#size' => 30,
);
$form['fstatus'] = array(
'#title' => t('Status'),
'#type' => 'select',
'#options' => array(
'proposed' => t('Proposed/Unknown/Other'),
'active' => t('Active'),
'inactive' => t('Out of Service/Temporarily Inactive'),
'abandoned' => t('Abandoned'),
'duplicate' => t('Duplicate'),
),
'#default_value' => $dh_feature->fstatus,
'#description' => t('The unique identifier used by the originating agency of this dH Feature type.'),
'#required' => TRUE,
'#multiple' => FALSE,
);
// Machine-readable type name.
$form['bundle'] = array(
'#type' => 'machine_name',
'#default_value' => isset($dh_feature->bundle) ? $dh_feature->bundle : '',
'#maxlength' => 32,
'#attributes' => array('disabled' => 'disabled'),
'#machine_name' => array(
'exists' => 'dh_feature_get_types',
'source' => array('label'),
),
'#description' => t('A unique machine-readable name for this model type. It must only contain lowercase letters, numbers, and underscores.'),
);
field_attach_form('dh_feature', $dh_feature, $form, $form_state);
$form['data']['#tree'] = TRUE;
/* $form['data']['description'] = array(
'#type' => 'textfield',
'#default_value' => $dh_feature->description,
'#description' => t('Detailed description of this dH Feature type.'),
'#required' => FALSE,
'#size' => 255,
);
*/
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save dH Feature type'),
'#weight' => 40,
);
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array('dh_feature_form_submit_delete')
);
//Locking not supported yet
/*if (!$dh_feature->isLocked() && $op != 'add') {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete model type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array('dh_feature_form_submit_delete')
);
}*/
return $form;
}
/**
* Form API submit callback for the type form.
*/
function dh_feature_form_submit(&$form, &$form_state) {
$dh_feature = entity_ui_form_submit_build_entity($form, $form_state);
$dh_feature->save();
$form_state['redirect'] = 'admin/content/dh_features';
}
/**
* Form API submit callback for the delete button.
*/
function dh_feature_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/content/dh_features/manage/' . $form_state['dh_feature']->hydroid . '/delete';
}
// Misc Fields
function dh_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'om_data_table-om_data_table-field_om_data_starttime'
$field_instances['dh_timeseries-tstime'] = array(
'bundle' => 'dh_timeseries',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'date',
'settings' => array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'date_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'dh_timeseries',
'field_name' => 'tstime',
'label' => 'Time',
'required' => 0,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'display_all_day' => 0,
'increment' => 15,
'input_format' => 'm/d/Y - H:i:s',
'input_format_custom' => '',
'label_position' => 'above',
'text_parts' => array(),
'year_range' => '-3:+3',
),
'type' => 'date_text',
'weight' => 1,
),
);
$field_instances['dh_timeseries-tsendtime'] = $field_instances['dh_timeseries-tstime'];
$field_instances['dh_timeseries-tsendtime']['field_name'] = 'tsendtime';
$field_instances['dh_timeseries-modified'] = $field_instances['dh_timeseries-modified'];
$field_instances['dh_timeseries-modified']['field_name'] = 'modified';
// Exported field_instance: 'om_data_table-om_data_table-field_om_data_starttime'
$field_instances['dh_properties-startdate'] = array(
'bundle' => 'dh_properties',
'deleted' => 0,
'description' => '',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'date',
'settings' => array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_from' => '',
'multiple_number' => '',
'multiple_to' => '',
),
'type' => 'date_default',
'weight' => 1,
),
'teaser' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
),
'entity_type' => 'dh_properties',
'field_name' => 'startdate',
'label' => 'Time',
'required' => 0,
'settings' => array(
'default_value' => 'now',
'default_value2' => 'same',
'default_value_code' => '',
'default_value_code2' => '',
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
'module' => 'date',
'settings' => array(
'display_all_day' => 0,
'increment' => 15,
'input_format' => 'm/d/Y - H:i:s',
'input_format_custom' => '',
'label_position' => 'above',
'text_parts' => array(),
'year_range' => '-3:+3',
),
'type' => 'date_text',
'weight' => 1,
),
);
$field_instances['dh_properties-enddate'] = $field_instances['dh_properties-startdate'];
$field_instances['dh_properties-enddate']['field_name'] = 'enddate';
$field_instances['dh_properties-enddate'] = $field_instances['dh_properties-startdate'];
$field_instances['dh_properties-modified']['field_name'] = 'modified';
$field_instances['dh_properties-modified'] = $field_instances['dh_properties-startdate'];
// Translatables
// Included for use with string extractors like potx.
t('Start Time');
return $field_instances;
}
/**
* dH HydrogeologicUnit editing form.
*/
function dh_hydrogeologicunit_form($form, &$form_state, $dh_hydrogeologicunit, $op = 'edit') {
if ($op == 'clone') {
$dh_hydrogeologicunit->name .= ' (cloned)';
$dh_hydrogeologicunit->bundle = '';
}
/* $form['hydroid'] = array(
'#title' => t('hydroid'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->hydroid,
'#description' => t('Primary key for Variables'),
'#required' => TRUE,
'#size' => 64,
);*/
$form['hgucode'] = array(
'#title' => t('Hydrogeologic Unit Code (HGU Code)'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->hgucode,
'#description' => t('Hydrogeologic unit code. The permanent identification code of hydrogeologic units, used to establish a linkage with external information systems.'),
'#required' => TRUE,
'#size' => 64,
);
$form['hguname'] = array(
'#title' => t('Hydrogeologic Unit Name'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->hguname,
'#description' => t('Text descriptor of hydrogeologic units used for labeling and symbolization.'),
'#required' => TRUE,
'#size' => 64,
);
$form['aqcode'] = array(
'#title' => t('Aquifer Code'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->aqcode,
'#description' => t('Aquifer code. Text descriptor of the aquifer used for labeling, symbolization, and querying.'),
'#required' => FALSE,
'#size' => 64,
);
$form['hydrocode'] = array(
'#title' => t('Hydro Code'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->hydrocode,
'#description' => t('Text field to associate with external data source.'),
'#required' => TRUE,
'#size' => 64,
);
$form['description'] = array(
'#title' => t('Description'),
'#type' => 'textfield',
'#default_value' => $dh_hydrogeologicunit->description,
'#description' => t('Text for storing detailed descriptions of hydrogeologic units.'),
'#required' => FALSE,
'#size' => 255,
);
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save dH HGU type'),
'#weight' => 40,
);
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete HGU'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array('dh_hydrogeologicunit_form_submit_delete')
);
return $form;
}
/*function dh_hydrogeologicunit_form_validate($form, &$form_state) {
//if (!($form_state['values']['price'] > 0)){
// form_set_error('price', t('Price must be a positive number.'));
// }
}*/
/**
* Form API submit callback for the type form.
*/
function dh_hydrogeologicunit_form_submit(&$form, &$form_state) {
$dh_hydrogeologicunit = entity_ui_form_submit_build_entity($form, $form_state);
$dh_hydrogeologicunit->save();
$form_state['redirect'] = 'admin/content/dh_hydrogeologicunit/';
}
function dh_hydrogeologicunit_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/content/dh_hydrogeologicunit/manage/' . $form_state['dh_hydrogeologicunit']->hydroid . '/delete';
}
/**
* dH Feature Type editing form.
*/
function dh_boreholelog_type_form($form, &$form_state, $dh_boreholelog_type, $op = 'edit') {
if ($op == 'clone') {
$dh_boreholelog_type->name .= ' (cloned)';
$dh_boreholelog_type->bundle = '';
}
$form['name'] = array(
'#title' => t('Borehole Log Type Name'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog_type->name,
'#description' => t('The human-readable name of this Borehole type.'),
'#required' => TRUE,
'#size' => 30,
);
// Machine-readable type name.
$form['bundle'] = array(
'#title' => t('Bundle Name'),
'#type' => 'machine_name',
'#default_value' => isset($dh_boreholelog_type->bundle) ? $dh_boreholelog_type->bundle : '',
'#maxlength' => 32,
// '#disabled' => $dh_boreholelog_type->isLocked() && $op != 'clone',
'#machine_name' => array(
'exists' => 'dh_feature_get_types',
'source' => array('label'),
),
'#description' => t('A unique machine-readable name for this model type. It must only contain lowercase letters, numbers, and underscores.'),
);
$form['description'] = array(
'#type' => 'textfield',
'#default_value' => $dh_boreholelog_type->description,
'#description' => t('Detailed description of this dH Feature type.'),
'#required' => FALSE,
'#size' => 255,
);
// $form['data']['#tree'] = TRUE;
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save dH Borehole type'),
'#weight' => 40,
);
//Locking not supported yet
///*if (!$dh_boreholelog_type->isLocked() && $op != 'add') {
$form['actions']['delete'] = array(
'#type' => 'submit',
'#value' => t('Delete model type'),
'#weight' => 45,
'#limit_validation_errors' => array(),
'#submit' => array('dh_boreholelog_type_form_submit_delete')
);
//}*/
return $form;
}
/**
* Form API submit callback for the type form.
*/
function dh_boreholelog_type_form_submit(&$form, &$form_state) {
$dh_boreholelog_type = entity_ui_form_submit_build_entity($form, $form_state);
$dh_boreholelog_type->save();
$form_state['redirect'] = 'admin/structure/dh_boreholelog_type';
}
/**
* Form API submit callback for the delete button.
*/
function dh_boreholelog_type_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/structure/dh_boreholelog_type/manage/' . $form_state['dh_boreholelog_type']->bundle . '/delete';
}
/**
* dH Boreholelog editing form.
*/
function dh_boreholelog_form($form, &$form_state, $dh_boreholelog, $op = 'edit') {
if ($op == 'clone') {
$dh_boreholelog->name .= ' (cloned)';
$dh_boreholelog->bundle = '';
}
/* $form['bhlid'] = array(
'#title' => t('Boreholelog ID'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->bhlid,
'#description' => t('Primary key for Variables'),
'#required' => TRUE,
'#size' => 64,
);*/
$form['fromdepth'] = array(
'#title' => t('From Depth'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->fromdepth,
'#description' => t('The top elevation of an interval measured as depth along the borehole.'),
'#required' => FALSE,
'#size' => 64,
);
$form['todepth'] = array(
'#title' => t('To Depth'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->todepth,
'#description' => t('The bottom elevation of an interval measured as depth along the borehole.'),
'#required' => FALSE,
'#size' => 64,
);
$form['topelev'] = array(
'#title' => t('Top Elevation'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->topelev,
'#description' => t('Top elevation of an interval represented in absolute elevation units (e.g., feet above mean sea level).'),
'#required' => FALSE,
'#size' => 64,
);
$form['bottomelev'] = array(
'#title' => t('Bottom Elevation'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->bottomelev,
'#description' => t('Bottom elevation of an interval represented in absolute elevation units (e.g., feet above mean sea level).'),
'#required' => FALSE,
'#size' => 64,
);
$form['refelev'] = array(
'#title' => t('Reference Elevation'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->refelev,
'#description' => t('Text for storing detailed descriptions of hydrogeologic units.'),
'#required' => FALSE,
'#size' => 255,
);
$form['material'] = array(
'#title' => t('Material'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->material,
'#description' => t('Description of strata observed along a borehole. Usually documented in drilling logs and later classified into geologic/hydrogeologic units.'),
'#required' => FALSE,
'#size' => 255,
);
$form['hgucode'] = array(
'#title' => t('HGU Code'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->hgucode,
'#description' => t('Hydrogeologic unit code. Text for classifying, symbolizing, and labeling hydrogeologic units. (External)'),
'#required' => FALSE,
'#size' => 255,
);
$form['logtype'] = array(
'#title' => t('Log Type'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->logtype,
'#description' => t('Distinguishes between types of borehole logs (e.g., well completion, hydrostratigraphy).'),
'#required' => FALSE,
'#size' => 255,
);
$itype = array(
'casing' => 'Casing',
'grout' => 'Grout',
'unit' => 'Unit',
'gravel_pack' => 'Gravel Pack',
'hole' => 'Hole',
'screen' => 'Screen',
'modflow_huf' => 'MODFLOW HUF',
'waterzone' => 'Water Zone',
'seal' => 'Seal',
'gravel_grout' => 'Undefined - Gravel or Grout',
'aquifer_top' => 'Aquifer Top',
);
ksort($itype);
$form['ftype'] = array(
'#title' => t('Interval Type'),
'#type' => 'select',
'#default_value' => $dh_boreholelog->ftype,
'#description' => t('Feature Type (grout, screen, casing)'),
'#required' => FALSE,
'#options' => $itype,
);
$valid = false;
$hguid_options = array();
$result = db_query("select hydroid, hguname from {dh_hydrogeologicunit} order by hguname");
while($rez = $result->fetchAssoc()) {
$hguid_options[$rez['hydroid']] = $rez['hguname'];
$valid = TRUE;
}
if (!$valid) {
$form['hguid'] = array(
'#title' => t('HGU ID'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->hguid,
'#description' => t('Link to ID column of table geologic/hydrogeologic units.'),
'#required' => FALSE,
'#size' => 8,
);
} else {
// got a list, let's use it
$form['hguid'] = array(
'#title' => t('HGU ID'),
'#type' => 'select',
'#options' => $hguid_options,
'#default_value' => $dh_boreholelog->hguid,
'#description' => t('Link to ID column of table geologic/hydrogeologic units.'),
'#required' => FALSE,
);
}
$form['diameter'] = array(
'#title' => t('Diameter'),
'#type' => 'textfield',
'#default_value' => $dh_boreholelog->diameter,
'#description' => t('Well diameter (in).'),