forked from Llewellynvdm/Joomla-Cost-Benefit-Projection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.php
1315 lines (1202 loc) · 91.7 KB
/
script.php
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
/*----------------------------------------------------------------------------------| www.giz.de |----/
Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
/-------------------------------------------------------------------------------------------------------/
@version 3.4.3
@build 17th May, 2018
@created 15th June, 2012
@package Cost Benefit Projection
@subpackage script.php
@author Llewellyn van der Merwe <http://www.vdm.io>
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
/-------------------------------------------------------------------------------------------------------/
Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.modal');
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
/**
* Script File of Costbenefitprojection Component
*/
class com_costbenefitprojectionInstallerScript
{
/**
* method to install the component
*
* @return void
*/
function install($parent)
{
}
/**
* method to uninstall the component
*
* @return void
*/
function uninstall($parent)
{
// Get Application object
$app = JFactory::getApplication();
// Get The Database object
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Company alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$company_found = $db->getNumRows();
// Now check if there were any rows
if ($company_found)
{
// Since there are load the needed company type ids
$company_ids = $db->loadColumn();
// Remove Company from the content type table
$company_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($company_condition);
$db->setQuery($query);
// Execute the query to remove Company items
$company_done = $db->execute();
if ($company_done);
{
// If succesfully remove Company add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Company items from the contentitem tag map table
$company_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.company') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($company_condition);
$db->setQuery($query);
// Execute the query to remove Company items
$company_done = $db->execute();
if ($company_done);
{
// If succesfully remove Company add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Company items from the ucm content table
$company_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.company') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($company_condition);
$db->setQuery($query);
// Execute the query to remove Company items
$company_done = $db->execute();
if ($company_done);
{
// If succesfully remove Company add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.company) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Company items are cleared from DB
foreach ($company_ids as $company_id)
{
// Remove Company items from the ucm base table
$company_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $company_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($company_condition);
$db->setQuery($query);
// Execute the query to remove Company items
$db->execute();
// Remove Company items from the ucm history table
$company_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $company_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($company_condition);
$db->setQuery($query);
// Execute the query to remove Company items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Service_provider alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$service_provider_found = $db->getNumRows();
// Now check if there were any rows
if ($service_provider_found)
{
// Since there are load the needed service_provider type ids
$service_provider_ids = $db->loadColumn();
// Remove Service_provider from the content type table
$service_provider_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($service_provider_condition);
$db->setQuery($query);
// Execute the query to remove Service_provider items
$service_provider_done = $db->execute();
if ($service_provider_done);
{
// If succesfully remove Service_provider add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Service_provider items from the contentitem tag map table
$service_provider_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.service_provider') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($service_provider_condition);
$db->setQuery($query);
// Execute the query to remove Service_provider items
$service_provider_done = $db->execute();
if ($service_provider_done);
{
// If succesfully remove Service_provider add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Service_provider items from the ucm content table
$service_provider_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.service_provider') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($service_provider_condition);
$db->setQuery($query);
// Execute the query to remove Service_provider items
$service_provider_done = $db->execute();
if ($service_provider_done);
{
// If succesfully remove Service_provider add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.service_provider) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Service_provider items are cleared from DB
foreach ($service_provider_ids as $service_provider_id)
{
// Remove Service_provider items from the ucm base table
$service_provider_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $service_provider_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($service_provider_condition);
$db->setQuery($query);
// Execute the query to remove Service_provider items
$db->execute();
// Remove Service_provider items from the ucm history table
$service_provider_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $service_provider_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($service_provider_condition);
$db->setQuery($query);
// Execute the query to remove Service_provider items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Country alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$country_found = $db->getNumRows();
// Now check if there were any rows
if ($country_found)
{
// Since there are load the needed country type ids
$country_ids = $db->loadColumn();
// Remove Country from the content type table
$country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($country_condition);
$db->setQuery($query);
// Execute the query to remove Country items
$country_done = $db->execute();
if ($country_done);
{
// If succesfully remove Country add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Country items from the contentitem tag map table
$country_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.country') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($country_condition);
$db->setQuery($query);
// Execute the query to remove Country items
$country_done = $db->execute();
if ($country_done);
{
// If succesfully remove Country add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Country items from the ucm content table
$country_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.country') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($country_condition);
$db->setQuery($query);
// Execute the query to remove Country items
$country_done = $db->execute();
if ($country_done);
{
// If succesfully remove Country add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.country) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Country items are cleared from DB
foreach ($country_ids as $country_id)
{
// Remove Country items from the ucm base table
$country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($country_condition);
$db->setQuery($query);
// Execute the query to remove Country items
$db->execute();
// Remove Country items from the ucm history table
$country_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $country_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($country_condition);
$db->setQuery($query);
// Execute the query to remove Country items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Causerisk alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$causerisk_found = $db->getNumRows();
// Now check if there were any rows
if ($causerisk_found)
{
// Since there are load the needed causerisk type ids
$causerisk_ids = $db->loadColumn();
// Remove Causerisk from the content type table
$causerisk_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($causerisk_condition);
$db->setQuery($query);
// Execute the query to remove Causerisk items
$causerisk_done = $db->execute();
if ($causerisk_done);
{
// If succesfully remove Causerisk add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Causerisk items from the contentitem tag map table
$causerisk_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.causerisk') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($causerisk_condition);
$db->setQuery($query);
// Execute the query to remove Causerisk items
$causerisk_done = $db->execute();
if ($causerisk_done);
{
// If succesfully remove Causerisk add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Causerisk items from the ucm content table
$causerisk_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.causerisk') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($causerisk_condition);
$db->setQuery($query);
// Execute the query to remove Causerisk items
$causerisk_done = $db->execute();
if ($causerisk_done);
{
// If succesfully remove Causerisk add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.causerisk) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Causerisk items are cleared from DB
foreach ($causerisk_ids as $causerisk_id)
{
// Remove Causerisk items from the ucm base table
$causerisk_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $causerisk_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($causerisk_condition);
$db->setQuery($query);
// Execute the query to remove Causerisk items
$db->execute();
// Remove Causerisk items from the ucm history table
$causerisk_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $causerisk_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($causerisk_condition);
$db->setQuery($query);
// Execute the query to remove Causerisk items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Health_data alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$health_data_found = $db->getNumRows();
// Now check if there were any rows
if ($health_data_found)
{
// Since there are load the needed health_data type ids
$health_data_ids = $db->loadColumn();
// Remove Health_data from the content type table
$health_data_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($health_data_condition);
$db->setQuery($query);
// Execute the query to remove Health_data items
$health_data_done = $db->execute();
if ($health_data_done);
{
// If succesfully remove Health_data add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Health_data items from the contentitem tag map table
$health_data_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.health_data') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($health_data_condition);
$db->setQuery($query);
// Execute the query to remove Health_data items
$health_data_done = $db->execute();
if ($health_data_done);
{
// If succesfully remove Health_data add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Health_data items from the ucm content table
$health_data_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.health_data') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($health_data_condition);
$db->setQuery($query);
// Execute the query to remove Health_data items
$health_data_done = $db->execute();
if ($health_data_done);
{
// If succesfully remove Health_data add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.health_data) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Health_data items are cleared from DB
foreach ($health_data_ids as $health_data_id)
{
// Remove Health_data items from the ucm base table
$health_data_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_data_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($health_data_condition);
$db->setQuery($query);
// Execute the query to remove Health_data items
$db->execute();
// Remove Health_data items from the ucm history table
$health_data_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_data_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($health_data_condition);
$db->setQuery($query);
// Execute the query to remove Health_data items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Scaling_factor alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$scaling_factor_found = $db->getNumRows();
// Now check if there were any rows
if ($scaling_factor_found)
{
// Since there are load the needed scaling_factor type ids
$scaling_factor_ids = $db->loadColumn();
// Remove Scaling_factor from the content type table
$scaling_factor_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($scaling_factor_condition);
$db->setQuery($query);
// Execute the query to remove Scaling_factor items
$scaling_factor_done = $db->execute();
if ($scaling_factor_done);
{
// If succesfully remove Scaling_factor add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Scaling_factor items from the contentitem tag map table
$scaling_factor_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.scaling_factor') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($scaling_factor_condition);
$db->setQuery($query);
// Execute the query to remove Scaling_factor items
$scaling_factor_done = $db->execute();
if ($scaling_factor_done);
{
// If succesfully remove Scaling_factor add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Scaling_factor items from the ucm content table
$scaling_factor_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.scaling_factor') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($scaling_factor_condition);
$db->setQuery($query);
// Execute the query to remove Scaling_factor items
$scaling_factor_done = $db->execute();
if ($scaling_factor_done);
{
// If succesfully remove Scaling_factor add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.scaling_factor) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Scaling_factor items are cleared from DB
foreach ($scaling_factor_ids as $scaling_factor_id)
{
// Remove Scaling_factor items from the ucm base table
$scaling_factor_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $scaling_factor_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($scaling_factor_condition);
$db->setQuery($query);
// Execute the query to remove Scaling_factor items
$db->execute();
// Remove Scaling_factor items from the ucm history table
$scaling_factor_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $scaling_factor_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($scaling_factor_condition);
$db->setQuery($query);
// Execute the query to remove Scaling_factor items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Intervention alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$intervention_found = $db->getNumRows();
// Now check if there were any rows
if ($intervention_found)
{
// Since there are load the needed intervention type ids
$intervention_ids = $db->loadColumn();
// Remove Intervention from the content type table
$intervention_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($intervention_condition);
$db->setQuery($query);
// Execute the query to remove Intervention items
$intervention_done = $db->execute();
if ($intervention_done);
{
// If succesfully remove Intervention add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Intervention items from the contentitem tag map table
$intervention_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.intervention') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($intervention_condition);
$db->setQuery($query);
// Execute the query to remove Intervention items
$intervention_done = $db->execute();
if ($intervention_done);
{
// If succesfully remove Intervention add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Intervention items from the ucm content table
$intervention_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.intervention') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($intervention_condition);
$db->setQuery($query);
// Execute the query to remove Intervention items
$intervention_done = $db->execute();
if ($intervention_done);
{
// If succesfully remove Intervention add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.intervention) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Intervention items are cleared from DB
foreach ($intervention_ids as $intervention_id)
{
// Remove Intervention items from the ucm base table
$intervention_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $intervention_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($intervention_condition);
$db->setQuery($query);
// Execute the query to remove Intervention items
$db->execute();
// Remove Intervention items from the ucm history table
$intervention_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $intervention_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($intervention_condition);
$db->setQuery($query);
// Execute the query to remove Intervention items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Currency alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$currency_found = $db->getNumRows();
// Now check if there were any rows
if ($currency_found)
{
// Since there are load the needed currency type ids
$currency_ids = $db->loadColumn();
// Remove Currency from the content type table
$currency_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($currency_condition);
$db->setQuery($query);
// Execute the query to remove Currency items
$currency_done = $db->execute();
if ($currency_done);
{
// If succesfully remove Currency add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Currency items from the contentitem tag map table
$currency_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.currency') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($currency_condition);
$db->setQuery($query);
// Execute the query to remove Currency items
$currency_done = $db->execute();
if ($currency_done);
{
// If succesfully remove Currency add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Currency items from the ucm content table
$currency_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.currency') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($currency_condition);
$db->setQuery($query);
// Execute the query to remove Currency items
$currency_done = $db->execute();
if ($currency_done);
{
// If succesfully remove Currency add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.currency) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Currency items are cleared from DB
foreach ($currency_ids as $currency_id)
{
// Remove Currency items from the ucm base table
$currency_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $currency_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($currency_condition);
$db->setQuery($query);
// Execute the query to remove Currency items
$db->execute();
// Remove Currency items from the ucm history table
$currency_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $currency_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($currency_condition);
$db->setQuery($query);
// Execute the query to remove Currency items
$db->execute();
}
}
// Create a new query object.
$query = $db->getQuery(true);
// Select id from content type table
$query->select($db->quoteName('type_id'));
$query->from($db->quoteName('#__content_types'));
// Where Help_document alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$help_document_found = $db->getNumRows();
// Now check if there were any rows
if ($help_document_found)
{
// Since there are load the needed help_document type ids
$help_document_ids = $db->loadColumn();
// Remove Help_document from the content type table
$help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($help_document_condition);
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Help_document items from the contentitem tag map table
$help_document_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_costbenefitprojection.help_document') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($help_document_condition);
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Help_document items from the ucm content table
$help_document_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_costbenefitprojection.help_document') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($help_document_condition);
$db->setQuery($query);
// Execute the query to remove Help_document items
$help_document_done = $db->execute();
if ($help_document_done);
{
// If succesfully remove Help_document add queued success message.
$app->enqueueMessage(JText::_('The (com_costbenefitprojection.help_document) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Help_document items are cleared from DB
foreach ($help_document_ids as $help_document_id)
{
// Remove Help_document items from the ucm base table
$help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($help_document_condition);
$db->setQuery($query);
// Execute the query to remove Help_document items
$db->execute();
// Remove Help_document items from the ucm history table
$help_document_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $help_document_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($help_document_condition);
$db->setQuery($query);
// Execute the query to remove Help_document items
$db->execute();
}
}
// If All related items was removed queued success message.
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__ucm_base</b> table'));
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__ucm_history</b> table'));
// Remove costbenefitprojection assets from the assets table
$costbenefitprojection_condition = array( $db->quoteName('name') . ' LIKE ' . $db->quote('com_costbenefitprojection%') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__assets'));
$query->where($costbenefitprojection_condition);
$db->setQuery($query);
$help_document_done = $db->execute();
if ($help_document_done);
{
// If succesfully remove costbenefitprojection add queued success message.
$app->enqueueMessage(JText::_('All related items was removed from the <b>#__assets</b> table'));
}
// little notice as after service, in case of bad experience with component.
echo '<h2>Did something go wrong? Are you disappointed?</h2>
<p>Please let me know at <a href="mailto:[email protected]">[email protected]</a>.
<br />We at Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb are committed to building extensions that performs proficiently! You can help us, really!
<br />Send me your thoughts on improvements that is needed, trust me, I will be very grateful!
<br />Visit us at <a href="http://www.vdm.io" target="_blank">http://www.vdm.io</a> today!</p>';
}
/**
* method to update the component
*
* @return void
*/
function update($parent)
{
}
/**
* method to run before an install/update/uninstall method
*
* @return void
*/
function preflight($type, $parent)
{
// get application
$app = JFactory::getApplication();
// is redundant ...hmmm
if ($type == 'uninstall')
{
return true;
}
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.6.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.6.0 before continuing!', 'error');
return false;
}
// do any updates needed
if ($type == 'update')
{
}
// do any install needed
if ($type == 'install')
{
}
}
/**
* method to run after an install/update/uninstall method
*
* @return void
*/
function postflight($type, $parent)
{
// get application
$app = JFactory::getApplication();
// set the default component settings
if ($type == 'install')
{
// Get The Database object
$db = JFactory::getDbo();
// Create the company content type object.
$company = new stdClass();
$company->type_title = 'Costbenefitprojection Company';
$company->type_alias = 'com_costbenefitprojection.company';
$company->table = '{"special": {"dbtable": "#__costbenefitprojection_company","key": "id","type": "Company","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$company->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","email":"email","user":"user","department":"department","country":"country","service_provider":"service_provider","per":"per","medical_turnovers_males":"medical_turnovers_males","females":"females","causesrisks":"causesrisks","sick_leave_males":"sick_leave_males","datayear":"datayear","medical_turnovers_females":"medical_turnovers_females","turnover_comment":"turnover_comment","working_days":"working_days","sick_leave_females":"sick_leave_females","total_salary":"total_salary","total_healthcare":"total_healthcare","productivity_losses":"productivity_losses","not_required":"not_required","males":"males"}}';
$company->router = 'CostbenefitprojectionHelperRoute::getCompanyRoute';
$company->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/company.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","user","department","country","service_provider","per","working_days","not_required"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "user","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__costbenefitprojection_country","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "service_provider","targetTable": "#__costbenefitprojection_service_provider","targetColumn": "id","displayColumn": "user"},{"sourceColumn": "causesrisks","targetTable": "#__costbenefitprojection_causerisk","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "datayear","targetTable": "#__costbenefitprojection_health_data","targetColumn": "year","displayColumn": "country"}]}';
// Set the object into the content types table.
$company_Inserted = $db->insertObject('#__content_types', $company);
// Create the service_provider content type object.
$service_provider = new stdClass();
$service_provider->type_title = 'Costbenefitprojection Service_provider';
$service_provider->type_alias = 'com_costbenefitprojection.service_provider';
$service_provider->table = '{"special": {"dbtable": "#__costbenefitprojection_service_provider","key": "id","type": "Service_provider","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$service_provider->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "user","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "publicaddress","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"user":"user","country":"country","publicname":"publicname","publicemail":"publicemail","publicnumber":"publicnumber","publicaddress":"publicaddress","testcompanies":"testcompanies"}}';
$service_provider->router = 'CostbenefitprojectionHelperRoute::getService_providerRoute';
$service_provider->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/service_provider.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","user","country"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "user","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__costbenefitprojection_country","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "testcompanies","targetTable": "#__costbenefitprojection_company","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$service_provider_Inserted = $db->insertObject('#__content_types', $service_provider);
// Create the country content type object.
$country = new stdClass();
$country->type_title = 'Costbenefitprojection Country';
$country->type_alias = 'com_costbenefitprojection.country';
$country->table = '{"special": {"dbtable": "#__costbenefitprojection_country","key": "id","type": "Country","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$country->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "publicaddress","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","user":"user","currency":"currency","codethree":"codethree","codetwo":"codetwo","working_days":"working_days","publicemail":"publicemail","publicnumber":"publicnumber","productivity_losses":"productivity_losses","publicname":"publicname","alias":"alias","publicaddress":"publicaddress","datayear":"datayear","worldzone":"worldzone","presenteeism":"presenteeism","causesrisks":"causesrisks","medical_turnovers":"medical_turnovers","sick_leave":"sick_leave","healthcare":"healthcare"}}';
$country->router = 'CostbenefitprojectionHelperRoute::getCountryRoute';
$country->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/country.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","user","working_days"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "user","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "currency","targetTable": "#__costbenefitprojection_currency","targetColumn": "codethree","displayColumn": "name"},{"sourceColumn": "datayear","targetTable": "#__costbenefitprojection_health_data","targetColumn": "year","displayColumn": "country"},{"sourceColumn": "causesrisks","targetTable": "#__costbenefitprojection_causerisk","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$country_Inserted = $db->insertObject('#__content_types', $country);
// Create the causerisk content type object.
$causerisk = new stdClass();
$causerisk->type_title = 'Costbenefitprojection Causerisk';
$causerisk->type_alias = 'com_costbenefitprojection.causerisk';
$causerisk->table = '{"special": {"dbtable": "#__costbenefitprojection_causerisk","key": "id","type": "Causerisk","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$causerisk->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","ref":"ref","importname":"importname","import_id":"import_id","description":"description","alias":"alias"}}';
$causerisk->router = 'CostbenefitprojectionHelperRoute::getCauseriskRoute';
$causerisk->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/causerisk.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","import_id"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$causerisk_Inserted = $db->insertObject('#__content_types', $causerisk);
// Create the health_data content type object.
$health_data = new stdClass();
$health_data->type_title = 'Costbenefitprojection Health_data';
$health_data->type_alias = 'com_costbenefitprojection.health_data';
$health_data->table = '{"special": {"dbtable": "#__costbenefitprojection_health_data","key": "id","type": "Health_data","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$health_data->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "causerisk","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"causerisk":"causerisk","year":"year","country":"country"}}';
$health_data->router = 'CostbenefitprojectionHelperRoute::getHealth_dataRoute';
$health_data->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/health_data.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","causerisk","country"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "causerisk","targetTable": "#__costbenefitprojection_causerisk","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__costbenefitprojection_country","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$health_data_Inserted = $db->insertObject('#__content_types', $health_data);
// Create the scaling_factor content type object.
$scaling_factor = new stdClass();
$scaling_factor->type_title = 'Costbenefitprojection Scaling_factor';
$scaling_factor->type_alias = 'com_costbenefitprojection.scaling_factor';
$scaling_factor->table = '{"special": {"dbtable": "#__costbenefitprojection_scaling_factor","key": "id","type": "Scaling_factor","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$scaling_factor->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "causerisk","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"causerisk":"causerisk","company":"company","yld_scaling_factor_males":"yld_scaling_factor_males","yld_scaling_factor_females":"yld_scaling_factor_females","mortality_scaling_factor_males":"mortality_scaling_factor_males","mortality_scaling_factor_females":"mortality_scaling_factor_females","presenteeism_scaling_factor_males":"presenteeism_scaling_factor_males","presenteeism_scaling_factor_females":"presenteeism_scaling_factor_females","health_scaling_factor":"health_scaling_factor","reference":"reference","country":"country"}}';
$scaling_factor->router = 'CostbenefitprojectionHelperRoute::getScaling_factorRoute';
$scaling_factor->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/scaling_factor.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","causerisk","company","country"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "causerisk","targetTable": "#__costbenefitprojection_causerisk","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "company","targetTable": "#__costbenefitprojection_company","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__costbenefitprojection_country","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$scaling_factor_Inserted = $db->insertObject('#__content_types', $scaling_factor);
// Create the intervention content type object.
$intervention = new stdClass();
$intervention->type_title = 'Costbenefitprojection Intervention';
$intervention->type_alias = 'com_costbenefitprojection.intervention';
$intervention->table = '{"special": {"dbtable": "#__costbenefitprojection_intervention","key": "id","type": "Intervention","prefix": "costbenefitprojectionTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}';
$intervention->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "null","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","company":"company","type":"type","coverage":"coverage","description":"description","duration":"duration","not_required":"not_required","interventions":"interventions","reference":"reference","share":"share","country":"country"}}';
$intervention->router = 'CostbenefitprojectionHelperRoute::getInterventionRoute';
$intervention->content_history_options = '{"formFile": "administrator/components/com_costbenefitprojection/models/forms/intervention.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","company","type","coverage","duration","not_required","share","country"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "company","targetTable": "#__costbenefitprojection_company","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "interventions","targetTable": "#__costbenefitprojection_intervention","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "country","targetTable": "#__costbenefitprojection_country","targetColumn": "id","displayColumn": "name"}]}';
// Set the object into the content types table.
$intervention_Inserted = $db->insertObject('#__content_types', $intervention);
// Create the currency content type object.
$currency = new stdClass();
$currency->type_title = 'Costbenefitprojection Currency';
$currency->type_alias = 'com_costbenefitprojection.currency';