-
Notifications
You must be signed in to change notification settings - Fork 9
/
script.php
6938 lines (6391 loc) · 405 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.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 3.0.0
@build 19th January, 2024
@created 19th January, 2024
@package eHealth Portal
@subpackage script.php
@author Llewellyn van der Merwe <https://git.vdm.dev/joomla/eHealth-Portal>
@copyright Copyright (C) 2020 Vast Development Method. All rights reserved.
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Portal for mobile health clinics
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Installer\Adapter\ComponentAdapter;
use Joomla\CMS\Version;
use Joomla\CMS\HTML\HTMLHelper as Html;
HTML::_('bootstrap.renderModal');
/**
* Script File of Ehealthportal Component
*/
class Com_EhealthportalInstallerScript
{
/**
* Constructor
*
* @param ComponentAdapter $parent The object responsible for running this script
*/
public function __construct(ComponentAdapter $parent) {}
/**
* Called on installation
*
* @param ComponentAdapter $parent The object responsible for running this script
*
* @return boolean True on success
*/
public function install(ComponentAdapter $parent) {}
/**
* Called on uninstallation
*
* @param ComponentAdapter $parent The object responsible for running this script
*/
public function uninstall(ComponentAdapter $parent)
{
// Get Application object
$app = Factory::getApplication();
// Get The Database object
$db = Factory::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 Payment alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.payment') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$payment_found = $db->getNumRows();
// Now check if there were any rows
if ($payment_found)
{
// Since there are load the needed payment type ids
$payment_ids = $db->loadColumn();
// Remove Payment from the content type table
$payment_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.payment') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($payment_condition);
$db->setQuery($query);
// Execute the query to remove Payment items
$payment_done = $db->execute();
if ($payment_done)
{
// If successfully remove Payment add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.payment) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Payment items from the contentitem tag map table
$payment_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.payment') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($payment_condition);
$db->setQuery($query);
// Execute the query to remove Payment items
$payment_done = $db->execute();
if ($payment_done)
{
// If successfully remove Payment add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.payment) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Payment items from the ucm content table
$payment_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.payment') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($payment_condition);
$db->setQuery($query);
// Execute the query to remove Payment items
$payment_done = $db->execute();
if ($payment_done)
{
// If successfully removed Payment add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.payment) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Payment items are cleared from DB
foreach ($payment_ids as $payment_id)
{
// Remove Payment items from the ucm base table
$payment_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($payment_condition);
$db->setQuery($query);
// Execute the query to remove Payment items
$db->execute();
// Remove Payment items from the ucm history table
$payment_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $payment_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($payment_condition);
$db->setQuery($query);
// Execute the query to remove Payment 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 General_medical_check_up alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.general_medical_check_up') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$general_medical_check_up_found = $db->getNumRows();
// Now check if there were any rows
if ($general_medical_check_up_found)
{
// Since there are load the needed general_medical_check_up type ids
$general_medical_check_up_ids = $db->loadColumn();
// Remove General_medical_check_up from the content type table
$general_medical_check_up_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.general_medical_check_up') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($general_medical_check_up_condition);
$db->setQuery($query);
// Execute the query to remove General_medical_check_up items
$general_medical_check_up_done = $db->execute();
if ($general_medical_check_up_done)
{
// If successfully remove General_medical_check_up add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.general_medical_check_up) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove General_medical_check_up items from the contentitem tag map table
$general_medical_check_up_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.general_medical_check_up') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($general_medical_check_up_condition);
$db->setQuery($query);
// Execute the query to remove General_medical_check_up items
$general_medical_check_up_done = $db->execute();
if ($general_medical_check_up_done)
{
// If successfully remove General_medical_check_up add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.general_medical_check_up) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove General_medical_check_up items from the ucm content table
$general_medical_check_up_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.general_medical_check_up') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($general_medical_check_up_condition);
$db->setQuery($query);
// Execute the query to remove General_medical_check_up items
$general_medical_check_up_done = $db->execute();
if ($general_medical_check_up_done)
{
// If successfully removed General_medical_check_up add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.general_medical_check_up) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the General_medical_check_up items are cleared from DB
foreach ($general_medical_check_up_ids as $general_medical_check_up_id)
{
// Remove General_medical_check_up items from the ucm base table
$general_medical_check_up_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $general_medical_check_up_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($general_medical_check_up_condition);
$db->setQuery($query);
// Execute the query to remove General_medical_check_up items
$db->execute();
// Remove General_medical_check_up items from the ucm history table
$general_medical_check_up_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $general_medical_check_up_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($general_medical_check_up_condition);
$db->setQuery($query);
// Execute the query to remove General_medical_check_up 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 Antenatal_care alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.antenatal_care') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$antenatal_care_found = $db->getNumRows();
// Now check if there were any rows
if ($antenatal_care_found)
{
// Since there are load the needed antenatal_care type ids
$antenatal_care_ids = $db->loadColumn();
// Remove Antenatal_care from the content type table
$antenatal_care_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.antenatal_care') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($antenatal_care_condition);
$db->setQuery($query);
// Execute the query to remove Antenatal_care items
$antenatal_care_done = $db->execute();
if ($antenatal_care_done)
{
// If successfully remove Antenatal_care add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.antenatal_care) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Antenatal_care items from the contentitem tag map table
$antenatal_care_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.antenatal_care') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($antenatal_care_condition);
$db->setQuery($query);
// Execute the query to remove Antenatal_care items
$antenatal_care_done = $db->execute();
if ($antenatal_care_done)
{
// If successfully remove Antenatal_care add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.antenatal_care) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Antenatal_care items from the ucm content table
$antenatal_care_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.antenatal_care') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($antenatal_care_condition);
$db->setQuery($query);
// Execute the query to remove Antenatal_care items
$antenatal_care_done = $db->execute();
if ($antenatal_care_done)
{
// If successfully removed Antenatal_care add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.antenatal_care) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Antenatal_care items are cleared from DB
foreach ($antenatal_care_ids as $antenatal_care_id)
{
// Remove Antenatal_care items from the ucm base table
$antenatal_care_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $antenatal_care_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($antenatal_care_condition);
$db->setQuery($query);
// Execute the query to remove Antenatal_care items
$db->execute();
// Remove Antenatal_care items from the ucm history table
$antenatal_care_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $antenatal_care_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($antenatal_care_condition);
$db->setQuery($query);
// Execute the query to remove Antenatal_care 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 Immunisation alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.immunisation') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$immunisation_found = $db->getNumRows();
// Now check if there were any rows
if ($immunisation_found)
{
// Since there are load the needed immunisation type ids
$immunisation_ids = $db->loadColumn();
// Remove Immunisation from the content type table
$immunisation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.immunisation') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($immunisation_condition);
$db->setQuery($query);
// Execute the query to remove Immunisation items
$immunisation_done = $db->execute();
if ($immunisation_done)
{
// If successfully remove Immunisation add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.immunisation) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Immunisation items from the contentitem tag map table
$immunisation_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.immunisation') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($immunisation_condition);
$db->setQuery($query);
// Execute the query to remove Immunisation items
$immunisation_done = $db->execute();
if ($immunisation_done)
{
// If successfully remove Immunisation add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.immunisation) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Immunisation items from the ucm content table
$immunisation_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.immunisation') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($immunisation_condition);
$db->setQuery($query);
// Execute the query to remove Immunisation items
$immunisation_done = $db->execute();
if ($immunisation_done)
{
// If successfully removed Immunisation add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.immunisation) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Immunisation items are cleared from DB
foreach ($immunisation_ids as $immunisation_id)
{
// Remove Immunisation items from the ucm base table
$immunisation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($immunisation_condition);
$db->setQuery($query);
// Execute the query to remove Immunisation items
$db->execute();
// Remove Immunisation items from the ucm history table
$immunisation_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $immunisation_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($immunisation_condition);
$db->setQuery($query);
// Execute the query to remove Immunisation 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 Vmmc alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.vmmc') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$vmmc_found = $db->getNumRows();
// Now check if there were any rows
if ($vmmc_found)
{
// Since there are load the needed vmmc type ids
$vmmc_ids = $db->loadColumn();
// Remove Vmmc from the content type table
$vmmc_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.vmmc') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($vmmc_condition);
$db->setQuery($query);
// Execute the query to remove Vmmc items
$vmmc_done = $db->execute();
if ($vmmc_done)
{
// If successfully remove Vmmc add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.vmmc) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Vmmc items from the contentitem tag map table
$vmmc_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.vmmc') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($vmmc_condition);
$db->setQuery($query);
// Execute the query to remove Vmmc items
$vmmc_done = $db->execute();
if ($vmmc_done)
{
// If successfully remove Vmmc add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.vmmc) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Vmmc items from the ucm content table
$vmmc_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.vmmc') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($vmmc_condition);
$db->setQuery($query);
// Execute the query to remove Vmmc items
$vmmc_done = $db->execute();
if ($vmmc_done)
{
// If successfully removed Vmmc add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.vmmc) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Vmmc items are cleared from DB
foreach ($vmmc_ids as $vmmc_id)
{
// Remove Vmmc items from the ucm base table
$vmmc_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $vmmc_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($vmmc_condition);
$db->setQuery($query);
// Execute the query to remove Vmmc items
$db->execute();
// Remove Vmmc items from the ucm history table
$vmmc_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $vmmc_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($vmmc_condition);
$db->setQuery($query);
// Execute the query to remove Vmmc 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 Prostate_and_testicular_cancer alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.prostate_and_testicular_cancer') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$prostate_and_testicular_cancer_found = $db->getNumRows();
// Now check if there were any rows
if ($prostate_and_testicular_cancer_found)
{
// Since there are load the needed prostate_and_testicular_cancer type ids
$prostate_and_testicular_cancer_ids = $db->loadColumn();
// Remove Prostate_and_testicular_cancer from the content type table
$prostate_and_testicular_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.prostate_and_testicular_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($prostate_and_testicular_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Prostate_and_testicular_cancer items
$prostate_and_testicular_cancer_done = $db->execute();
if ($prostate_and_testicular_cancer_done)
{
// If successfully remove Prostate_and_testicular_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.prostate_and_testicular_cancer) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Prostate_and_testicular_cancer items from the contentitem tag map table
$prostate_and_testicular_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.prostate_and_testicular_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($prostate_and_testicular_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Prostate_and_testicular_cancer items
$prostate_and_testicular_cancer_done = $db->execute();
if ($prostate_and_testicular_cancer_done)
{
// If successfully remove Prostate_and_testicular_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.prostate_and_testicular_cancer) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Prostate_and_testicular_cancer items from the ucm content table
$prostate_and_testicular_cancer_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.prostate_and_testicular_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($prostate_and_testicular_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Prostate_and_testicular_cancer items
$prostate_and_testicular_cancer_done = $db->execute();
if ($prostate_and_testicular_cancer_done)
{
// If successfully removed Prostate_and_testicular_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.prostate_and_testicular_cancer) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Prostate_and_testicular_cancer items are cleared from DB
foreach ($prostate_and_testicular_cancer_ids as $prostate_and_testicular_cancer_id)
{
// Remove Prostate_and_testicular_cancer items from the ucm base table
$prostate_and_testicular_cancer_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $prostate_and_testicular_cancer_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($prostate_and_testicular_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Prostate_and_testicular_cancer items
$db->execute();
// Remove Prostate_and_testicular_cancer items from the ucm history table
$prostate_and_testicular_cancer_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $prostate_and_testicular_cancer_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($prostate_and_testicular_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Prostate_and_testicular_cancer 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 Tuberculosis alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.tuberculosis') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$tuberculosis_found = $db->getNumRows();
// Now check if there were any rows
if ($tuberculosis_found)
{
// Since there are load the needed tuberculosis type ids
$tuberculosis_ids = $db->loadColumn();
// Remove Tuberculosis from the content type table
$tuberculosis_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.tuberculosis') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($tuberculosis_condition);
$db->setQuery($query);
// Execute the query to remove Tuberculosis items
$tuberculosis_done = $db->execute();
if ($tuberculosis_done)
{
// If successfully remove Tuberculosis add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.tuberculosis) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Tuberculosis items from the contentitem tag map table
$tuberculosis_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.tuberculosis') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($tuberculosis_condition);
$db->setQuery($query);
// Execute the query to remove Tuberculosis items
$tuberculosis_done = $db->execute();
if ($tuberculosis_done)
{
// If successfully remove Tuberculosis add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.tuberculosis) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Tuberculosis items from the ucm content table
$tuberculosis_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.tuberculosis') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($tuberculosis_condition);
$db->setQuery($query);
// Execute the query to remove Tuberculosis items
$tuberculosis_done = $db->execute();
if ($tuberculosis_done)
{
// If successfully removed Tuberculosis add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.tuberculosis) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Tuberculosis items are cleared from DB
foreach ($tuberculosis_ids as $tuberculosis_id)
{
// Remove Tuberculosis items from the ucm base table
$tuberculosis_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $tuberculosis_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($tuberculosis_condition);
$db->setQuery($query);
// Execute the query to remove Tuberculosis items
$db->execute();
// Remove Tuberculosis items from the ucm history table
$tuberculosis_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $tuberculosis_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($tuberculosis_condition);
$db->setQuery($query);
// Execute the query to remove Tuberculosis 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 Hiv_counseling_and_testing alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.hiv_counseling_and_testing') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$hiv_counseling_and_testing_found = $db->getNumRows();
// Now check if there were any rows
if ($hiv_counseling_and_testing_found)
{
// Since there are load the needed hiv_counseling_and_testing type ids
$hiv_counseling_and_testing_ids = $db->loadColumn();
// Remove Hiv_counseling_and_testing from the content type table
$hiv_counseling_and_testing_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.hiv_counseling_and_testing') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($hiv_counseling_and_testing_condition);
$db->setQuery($query);
// Execute the query to remove Hiv_counseling_and_testing items
$hiv_counseling_and_testing_done = $db->execute();
if ($hiv_counseling_and_testing_done)
{
// If successfully remove Hiv_counseling_and_testing add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.hiv_counseling_and_testing) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Hiv_counseling_and_testing items from the contentitem tag map table
$hiv_counseling_and_testing_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.hiv_counseling_and_testing') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($hiv_counseling_and_testing_condition);
$db->setQuery($query);
// Execute the query to remove Hiv_counseling_and_testing items
$hiv_counseling_and_testing_done = $db->execute();
if ($hiv_counseling_and_testing_done)
{
// If successfully remove Hiv_counseling_and_testing add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.hiv_counseling_and_testing) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Hiv_counseling_and_testing items from the ucm content table
$hiv_counseling_and_testing_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.hiv_counseling_and_testing') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($hiv_counseling_and_testing_condition);
$db->setQuery($query);
// Execute the query to remove Hiv_counseling_and_testing items
$hiv_counseling_and_testing_done = $db->execute();
if ($hiv_counseling_and_testing_done)
{
// If successfully removed Hiv_counseling_and_testing add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.hiv_counseling_and_testing) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Hiv_counseling_and_testing items are cleared from DB
foreach ($hiv_counseling_and_testing_ids as $hiv_counseling_and_testing_id)
{
// Remove Hiv_counseling_and_testing items from the ucm base table
$hiv_counseling_and_testing_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $hiv_counseling_and_testing_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($hiv_counseling_and_testing_condition);
$db->setQuery($query);
// Execute the query to remove Hiv_counseling_and_testing items
$db->execute();
// Remove Hiv_counseling_and_testing items from the ucm history table
$hiv_counseling_and_testing_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $hiv_counseling_and_testing_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($hiv_counseling_and_testing_condition);
$db->setQuery($query);
// Execute the query to remove Hiv_counseling_and_testing 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 Family_planning alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.family_planning') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$family_planning_found = $db->getNumRows();
// Now check if there were any rows
if ($family_planning_found)
{
// Since there are load the needed family_planning type ids
$family_planning_ids = $db->loadColumn();
// Remove Family_planning from the content type table
$family_planning_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.family_planning') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($family_planning_condition);
$db->setQuery($query);
// Execute the query to remove Family_planning items
$family_planning_done = $db->execute();
if ($family_planning_done)
{
// If successfully remove Family_planning add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.family_planning) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Family_planning items from the contentitem tag map table
$family_planning_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.family_planning') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($family_planning_condition);
$db->setQuery($query);
// Execute the query to remove Family_planning items
$family_planning_done = $db->execute();
if ($family_planning_done)
{
// If successfully remove Family_planning add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.family_planning) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Family_planning items from the ucm content table
$family_planning_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.family_planning') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($family_planning_condition);
$db->setQuery($query);
// Execute the query to remove Family_planning items
$family_planning_done = $db->execute();
if ($family_planning_done)
{
// If successfully removed Family_planning add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.family_planning) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Family_planning items are cleared from DB
foreach ($family_planning_ids as $family_planning_id)
{
// Remove Family_planning items from the ucm base table
$family_planning_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $family_planning_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($family_planning_condition);
$db->setQuery($query);
// Execute the query to remove Family_planning items
$db->execute();
// Remove Family_planning items from the ucm history table
$family_planning_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $family_planning_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($family_planning_condition);
$db->setQuery($query);
// Execute the query to remove Family_planning 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_education alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.health_education') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$health_education_found = $db->getNumRows();
// Now check if there were any rows
if ($health_education_found)
{
// Since there are load the needed health_education type ids
$health_education_ids = $db->loadColumn();
// Remove Health_education from the content type table
$health_education_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.health_education') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($health_education_condition);
$db->setQuery($query);
// Execute the query to remove Health_education items
$health_education_done = $db->execute();
if ($health_education_done)
{
// If successfully remove Health_education add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.health_education) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Health_education items from the contentitem tag map table
$health_education_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.health_education') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($health_education_condition);
$db->setQuery($query);
// Execute the query to remove Health_education items
$health_education_done = $db->execute();
if ($health_education_done)
{
// If successfully remove Health_education add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.health_education) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Health_education items from the ucm content table
$health_education_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.health_education') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($health_education_condition);
$db->setQuery($query);
// Execute the query to remove Health_education items
$health_education_done = $db->execute();
if ($health_education_done)
{
// If successfully removed Health_education add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.health_education) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Health_education items are cleared from DB
foreach ($health_education_ids as $health_education_id)
{
// Remove Health_education items from the ucm base table
$health_education_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_education_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));
$query->where($health_education_condition);
$db->setQuery($query);
// Execute the query to remove Health_education items
$db->execute();
// Remove Health_education items from the ucm history table
$health_education_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $health_education_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_history'));
$query->where($health_education_condition);
$db->setQuery($query);
// Execute the query to remove Health_education 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 Cervical_cancer alias is found
$query->where( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.cervical_cancer') );
$db->setQuery($query);
// Execute query to see if alias is found
$db->execute();
$cervical_cancer_found = $db->getNumRows();
// Now check if there were any rows
if ($cervical_cancer_found)
{
// Since there are load the needed cervical_cancer type ids
$cervical_cancer_ids = $db->loadColumn();
// Remove Cervical_cancer from the content type table
$cervical_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.cervical_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__content_types'));
$query->where($cervical_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Cervical_cancer items
$cervical_cancer_done = $db->execute();
if ($cervical_cancer_done)
{
// If successfully remove Cervical_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.cervical_cancer) type alias was removed from the <b>#__content_type</b> table'));
}
// Remove Cervical_cancer items from the contentitem tag map table
$cervical_cancer_condition = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_ehealthportal.cervical_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__contentitem_tag_map'));
$query->where($cervical_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Cervical_cancer items
$cervical_cancer_done = $db->execute();
if ($cervical_cancer_done)
{
// If successfully remove Cervical_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.cervical_cancer) type alias was removed from the <b>#__contentitem_tag_map</b> table'));
}
// Remove Cervical_cancer items from the ucm content table
$cervical_cancer_condition = array( $db->quoteName('core_type_alias') . ' = ' . $db->quote('com_ehealthportal.cervical_cancer') );
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_content'));
$query->where($cervical_cancer_condition);
$db->setQuery($query);
// Execute the query to remove Cervical_cancer items
$cervical_cancer_done = $db->execute();
if ($cervical_cancer_done)
{
// If successfully removed Cervical_cancer add queued success message.
$app->enqueueMessage(Text::_('The (com_ehealthportal.cervical_cancer) type alias was removed from the <b>#__ucm_content</b> table'));
}
// Make sure that all the Cervical_cancer items are cleared from DB
foreach ($cervical_cancer_ids as $cervical_cancer_id)
{
// Remove Cervical_cancer items from the ucm base table
$cervical_cancer_condition = array( $db->quoteName('ucm_type_id') . ' = ' . $cervical_cancer_id);
// Create a new query object.
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__ucm_base'));